SAve lossless copies of images (JP2 -> JP2)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Rasmus

SAve lossless copies of images (JP2 -> JP2)

Post by Rasmus »

Hi,

I need to change a number of images. For that, I am attaching (-splice) a new area to the image I have and write onto that (-annotate)

Other than that, I do not touch the original image.

However, when I save the final image, I end up with a lossy copy. (Fewer number of total colours used, and compare.exe creates a ghostly copy of the two images - which seems to suggest that the differences are actually quite large.)

Original image:
JPEG2000 - Wavelet
3289 x 2193 Pixels
16,7 Millions (24 BitsPerPixel) Colours
158463 unique colours

Output Image:
3289 x 2273 Pixels
157781 unique colours

(as per Irfanview, other values remain the same)
Now, the added pixels come from the splice-operation and are what they should be. But I should have the same number of unique colours - or more, depending on whether the two colours I use are already in the picture or not.

I have tried to look at the settings for jp2 but have to admit I don't really understand those. I know that jpeg can only be handled lossless if the image has a certain size (multiples of 16 pixels? I forgot.) Is it anything like that at all?

Also, I did force the output as TIFF at a time and had the same problem - so I am not even sure if it's the saving of the image that is the issue here, or if my conversion or even the opening of the original is already changing the colours.

Any pointers or ideas, anyone? (I'll happily take a full-fledged solution, too - but just knowing what to look at would be good as well.)

Thanks,
Rasmus.


ETA:
ImageMagic 6.3.9 Q8 through an object call with AutoIT: $img.Convert( ...

I can provide all the parameters I am using, but since these are generated on the fly I'd have to go and compile them. I'll do that unless there is a more obvious solution.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: SAve lossless copies of images (JP2 -> JP2)

Post by snibgo »

JPEG 2000 can be lossy, so I would guess the exact command/parameters would be relevant if you want it to be lossless.

You might post a link to the image.

And you might update IM.
snibgo's IM pages: im.snibgo.com
Rasmus

Re: SAve lossless copies of images (JP2 -> JP2)

Post by Rasmus »

I'll try the update next, if that doesn't work I will extract the object call. I amnot sure if I can get permission to post any of the source images, though.

Thanks.
Rasmus

Re: SAve lossless copies of images (JP2 -> JP2)

Post by Rasmus »

Thwe update to a current Q16 seems to have done the trick. Also, I have now "-type", "truecolor" to force both the read and write of the files into the right type. I noticed that it was saving as truecolormatte before.

Again, thank you for the suggestions.
Post Reply