Page 1 of 1

Replacing profiles without decompressing/compressing image

Posted: 2006-09-06T03:40:39-07:00
by mact
Moin,

I am sure I have read about a way to deal with image profiles (IPTC, color profiles etc) without actually decompressing and recompressing the image, but I cannot find the tag/flag any more that lets me do it.

Could someone please point me in the right direction?

Thanks!

Marc

Posted: 2006-09-06T06:52:08-07:00
by magick
See http://www.cit.gu.edu.au/~anthony/graph ... jpg_non_im for a discussion of dealing with profiles

Posted: 2006-09-06T09:07:32-07:00
by mact
Hi,

thanks for the link, unfortunately only the common tools are discussed there (like exiftool and the like). I would like to stick with one toolset (or library). Currently I am doing the IPTC-replacement myself (by means of a very simple JPEG parser) but I'd love to use IM core to do deal with non-image data in an image file conveniently.

Marc

Re: Replacing profiles without decompressing/compressing image

Posted: 2007-06-07T07:36:07-07:00
by sacha
There was this in the announcement of ImageMagick 5.4.7:
+ Lossless JPEG embedding (similar to provided by iptcutil) is supported.
Does anyone have any sample code?

Re: Replacing profiles without decompressing/compressing image

Posted: 2007-06-07T16:34:05-07:00
by anthony
Lossless JPEG is only supported with the NEW JPEG2000 library.
The old library does not understand lossless.

Re: Replacing profiles without decompressing/compressing image

Posted: 2007-06-08T15:00:41-07:00
by sacha
The OP is about embedding profiles into JPEGs "losslessly" i.e. without decompressing and recompressing the JPEG. I believe this can be done with iptcutil (see the jpegembed function), so I'd understood the changelog to indicate that this was now possible via the ImageMagick APIs.

I think lossless JPEG ("quality 100") is a red herring.

Re: Replacing profiles without decompressing/compressing image

Posted: 2007-06-20T20:35:17-07:00
by anthony
IM is basically a image processor. It will always read and write the image data, and for normal jpeg that means it is always lossy.

It is not primarally a profile handler, or try to handles specific format problems, though it does some of that for image conversion.

For lossless profile handling IM is NOT the program to use. That is whay I listed thos non-im tools for lossless JPEG handling.

You will be hard pressed to find any tool that does all things.
JohnNavarra wrote:Sometimes we need a hammer and sometimes a screwdriver.
IM come close, for image conversion, but it can never do everything! That is imposible!

Re: Replacing profiles without decompressing/compressing image

Posted: 2007-06-29T08:05:18-07:00
by sacha
Ok. It was the message in the Changelog that made me think ImageMagick might be able to do it; it would still be interesting to know what that was referring to.

For what it's worth, I think many lossless operations on the image container might be possible if file container parsing were decoupled from decoding.

If you look at the source for many of the coders, they do just that. They find out as much as they can about the image, setting up data structures, and then decode the image into the pixel cache.

At the API level, perhaps it could be something like:

// read an image file without decoding the image data
MagickOpenImage(filename)

This would parse the image file, extracting all the relevant information (height, width, colourspace, profiles etc) but not decode the image, just read the bytes into memory (or some structure telling it how to extract the bytes, e.g. a file descriptor, offset and byte length). This would allow operations on the container (setting profiles etc) without modifying the image data.

Anyway thanks for your responses; I'll see if I can find another tool to do what I need.