How to image()/image.write() & not change format?
Posted: 2013-07-27T12:41:10-07:00
I'm using Magick++ (ImageMagick 6.8.0-10 2013-06-22 Q16) on a Mac to alter the hue of Android theme images. (Basically, I'm taking the images from a theme and shifting them from, for instance, blue to yellow.) Many of these are nine-patch (.9.png) which use a 1-pixel border of black/transparent to define scalable and fillable areas. If I mess up that border then the image doesn't scale/fill correctly which causes many things to display incorrectly.
After sorting out the hue-shift code, I spent quite a bit of time trying to figure out why the altered images were bad. Using 'identify', I realized that even if I make no modifications to the image, the output is different from the input.
I've removed all of the hue shift code to create a test app that simply writes out the image it read:
InitializeMagick(*argv);
Image image(argv[1]);
sprintf(output,"new-%s", argv[1]);
image.write(output);
Output of 'identify -verbose orig.9.png": http://pastebin.com/uWFxL5rL
Output of 'identify -verbose new-orig.9.png": http://pastebin.com/H1su9VRg
Difference of the two: http://pastebin.com/tVEt4BLX
I know that image.write() is smart enough to convert to different output formats and I suspect that the ".png" suffix is triggering that action & leading to my problems but I'm new to the Magick++ API and can't figure out what I need to do not trigger that behavior.
Thank you!
After sorting out the hue-shift code, I spent quite a bit of time trying to figure out why the altered images were bad. Using 'identify', I realized that even if I make no modifications to the image, the output is different from the input.
I've removed all of the hue shift code to create a test app that simply writes out the image it read:
InitializeMagick(*argv);
Image image(argv[1]);
sprintf(output,"new-%s", argv[1]);
image.write(output);
Output of 'identify -verbose orig.9.png": http://pastebin.com/uWFxL5rL
Output of 'identify -verbose new-orig.9.png": http://pastebin.com/H1su9VRg
Difference of the two: http://pastebin.com/tVEt4BLX
I know that image.write() is smart enough to convert to different output formats and I suspect that the ".png" suffix is triggering that action & leading to my problems but I'm new to the Magick++ API and can't figure out what I need to do not trigger that behavior.
Thank you!