Help Converting Halftone Offset to iOS

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
Post Reply
ImageGandalf
Posts: 15
Joined: 2014-04-14T11:40:01-07:00
Authentication code: 6789

Help Converting Halftone Offset to iOS

Post by ImageGandalf »

Hi,

I'm looking for an ImageMagick expert to help me translate this halftone offset script that is listed in the docs to iOS:

Code: Select all

  convert parrots_med.png  -set option:distort:viewport '%wx%h+0+0' \
          -colorspace CMYK -separate null: \
          \( -size 2x2 xc: \( +clone -negate \) \
                +append \( +clone -negate \) -append \) \
          -virtual-pixel tile -filter gaussian \
          \( +clone -distort SRT 2,60 \) +swap \
          \( +clone -distort SRT 2,30 \) +swap \
          \( +clone -distort SRT 2,45 \) +swap \
          \( +clone -distort SRT 2,0  -blur 0x0.7 \) +swap +delete \
          -compose Overlay -layers composite \
          -set colorspace CMYK -combine -colorspace RGB \
          offset_parrots.png

I have managed to make a simple script that applies a poster effect to a UIImage:

Code: Select all

    MagickWandGenesis();

    MagickWand *wand = NewMagickWand();
    NSData *inData = UIImagePNGRepresentation(self.originalImage);
    MagickReadImageBlob(wand, [inData bytes], [inData length]);
   
    ImageInfo *image_info = AcquireImageInfo();
    ExceptionInfo *exception = AcquireExceptionInfo();
   
    MagickBooleanType status = MagickPosterizeImage(wand,6,MagickFalse);
    
    if (exception->severity != UndefinedException)
    {
        status = MagickTrue;
        CatchException(exception);
    }
    
    if (status == MagickFalse)
    {
        NSLog(@"FAIL");
    }
    
    size_t my_size;
    unsigned char * my_image = MagickGetImageBlob(wand, &my_size);
    NSData *outData = [[NSData alloc] initWithBytes:my_image length:my_size];
    free(my_image);
    
    self.imageView.image = [[UIImage alloc] initWithData:outData];
    
    image_info=DestroyImageInfo(image_info);
    exception=DestroyExceptionInfo(exception);
    DestroyMagickWand(wand);
    MagickWandTerminus();
So what I would need would be this line:

Code: Select all

MagickBooleanType status = MagickPosterizeImage(wand,6,MagickFalse);
replaced with the code necessary to apply the above halftone offset as efficiently as possible.

Please private message me if this is something you think you could do.

Thanks.
Post Reply