Non-destructive conversion of JPEGs to multi-page TIFF
-
- Posts: 6
- Joined: 2013-09-04T18:56:41-07:00
- Authentication code: 6789
Non-destructive conversion of JPEGs to multi-page TIFF
I need to convert several jpeg images at a time into a single, multi-page tiff without losing the compression or the quality. IM can create tiff's with jpeg compression just fine. The only problem is that it does a new encode for the jpeg data regardless of the original image format. Previously, this wasn't a problem because the images I was using were all high quality and in lossless formats so I could crank up the compression and, with just one jpeg encoding in the whole process, not take too much of a hit on quality (for my purposes). Now, some of the images I'm using are only available to me as highly compressed jpeg's (quality: ~45). I realize the damage is already done but I'd really hate to lose even more quality with an unnecessary re-encode just because I want them combined as a single tiff. The tiff files I end up with, ultimately, are going online so converting to, for instance, lossless tiff or a higher jpeg quality isn't practical.
Someone brought up a similar problem (http://www.asmail.be/msg0054853059.html) to the libtiff folks better than 4 years ago and the discussion that followed went into a lot more depth about the technical details and provide a good picture as to why this is hardly a trivial problem. Unfortunately, as far as I can tell, nothing actually came of that discussion (or at least made it into libtiff). By some of the comments in libtiff's source code (note: I am not a programmer), I got the impression that the IJG implemented most of the jpeg functionality in libtiff and considering someone knowledgeable in the details of both formats would be required to take that implementation any further, I can definitely see where this one simply fell through the cracks.
Bearing that in mind, I would be eternally grateful if this could be implemented in IM because, with the exception of this one problem, it's been a terrific program to use and there seems to be a lot of support for it. If someone knows of another way, I'd be appreciate knowing more about that, too.
Thanks
Someone brought up a similar problem (http://www.asmail.be/msg0054853059.html) to the libtiff folks better than 4 years ago and the discussion that followed went into a lot more depth about the technical details and provide a good picture as to why this is hardly a trivial problem. Unfortunately, as far as I can tell, nothing actually came of that discussion (or at least made it into libtiff). By some of the comments in libtiff's source code (note: I am not a programmer), I got the impression that the IJG implemented most of the jpeg functionality in libtiff and considering someone knowledgeable in the details of both formats would be required to take that implementation any further, I can definitely see where this one simply fell through the cracks.
Bearing that in mind, I would be eternally grateful if this could be implemented in IM because, with the exception of this one problem, it's been a terrific program to use and there seems to be a lot of support for it. If someone knows of another way, I'd be appreciate knowing more about that, too.
Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Non-destructive conversion of JPEGs to multi-page TIFF
As far as I know, IM will decompress a jpg and if you use jpg compression for your tiff, then it will recompress. It will not just take the jpg and enclose it in a Tiff wrapper.
You could try adding -quality 100 to your command before writing to the tiff output, if you are using jpg compression in your resulting tiff.
Better would be to write to some other non-lossy compression in your Tiff.
see
http://www.imagemagick.org/script/comma ... p#compress
http://www.imagemagick.org/script/comma ... hp#quality
http://www.imagemagick.org/script/comma ... ing-factor
http://www.imagemagick.org/Usage/formats/#tiff
You could try adding -quality 100 to your command before writing to the tiff output, if you are using jpg compression in your resulting tiff.
Better would be to write to some other non-lossy compression in your Tiff.
see
http://www.imagemagick.org/script/comma ... p#compress
http://www.imagemagick.org/script/comma ... hp#quality
http://www.imagemagick.org/script/comma ... ing-factor
http://www.imagemagick.org/Usage/formats/#tiff
-
- Posts: 6
- Joined: 2013-09-04T18:56:41-07:00
- Authentication code: 6789
Re: Non-destructive conversion of JPEGs to multi-page TIFF
Thanks for the quick reply but...
fmw42 wrote:You could try adding -quality 100 to your command before writing to the tiff output, if you are using jpg compression in your resulting tiff.
Better would be to write to some other non-lossy compression in your Tiff.
globalodey wrote:The tiff files I end up with, ultimately, are going online so converting to, for instance, lossless tiff or a higher jpeg quality isn't practical.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Non-destructive conversion of JPEGs to multi-page TIFF
I'm not aware of any software that will take a number of JPEG files and collate them unchanged into a single TIFF. Certainly, IM can't do this.
You might do some experiments with your files: see how much the size increases when saved as non-lossy compressed (probably Zip or LZW) TIFFs. Save as JPG with no quality change, or "-quality 100", and see how the size changes and how the image changes (do a "compare -metric RMSE").
Other possibilities include creating an archive or zip file of the JPEG files. But I fear your first sentence ...
You might do some experiments with your files: see how much the size increases when saved as non-lossy compressed (probably Zip or LZW) TIFFs. Save as JPG with no quality change, or "-quality 100", and see how the size changes and how the image changes (do a "compare -metric RMSE").
Other possibilities include creating an archive or zip file of the JPEG files. But I fear your first sentence ...
... doesn't have a solution without writing new software.I need to convert several jpeg images at a time into a single, multi-page tiff without losing the compression or the quality.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Non-destructive conversion of JPEGs to multi-page TIFF
Did you search Google? I came across this doing a search.
http://maptools-org.996276.n3.nabble.co ... d3386.html
http://maptools-org.996276.n3.nabble.co ... d3386.html
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Non-destructive conversion of JPEGs to multi-page TIFF
sam2p can't create multi-image tiffs. Creating a tiff from a jpeg, with no options, slightly changes the image, but a job parameter might fix that.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Non-destructive conversion of JPEGs to multi-page TIFF
If it really wraps the jpg with a Tiff enclosure without decompressing and recompressing, then you could write a script to use sam2p to convert all the jpgs to single tiff files and have IM combine them into a multipage TIFF.
Last edited by fmw42 on 2013-09-12T16:48:10-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Non-destructive conversion of JPEGs to multi-page TIFF
Sorry, accidentally posted again by clicking the wrong link. Have no permission to delete.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Non-destructive conversion of JPEGs to multi-page TIFF
As far as I can see, when IM reads a jpeg-in-tiff and writes another jpeg-in-tiff, it always unpacks the pixels and re-compresses them. (This can be shown by comparing input and output images.) This applies for single images and multiple images.fmw42 wrote:... you could write a script to use sam2p to convert all the jpgs to single tiff files and have IM combine them into a multipage TIFF.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Non-destructive conversion of JPEGs to multi-page TIFF
Yes, I forgot about that. Thanks for catching it.snibgo wrote:As far as I can see, when IM reads a jpeg-in-tiff and writes another jpeg-in-tiff, it always unpacks the pixels and re-compresses them. (This can be shown by comparing input and output images.) This applies for single images and multiple images
-
- Posts: 6
- Joined: 2013-09-04T18:56:41-07:00
- Authentication code: 6789
Re: Non-destructive conversion of JPEGs to multi-page TIFF
Unfortunately, I've been up and down Google's search results for the last month researching this. I remembered coming across the page talking about sam2p and hitting a dead end but I couldn't remember why. It became obvious today when I tried to build it again: configure won't even run all the way. I don't know if this is OS X specific or what. At any rate, it sounds like a it's a moot point now if IM can't adjoin multiple tiff images into a single tiff file without re-encoding.
Thanks to you both for really digging in to try to find a way to do this but it looks like things have moved pretty firmly into the realm of a feature request now. Is it necessary to post a new topic or is there a way to just move this whole thread to the developer forum?
Thanks to you both for really digging in to try to find a way to do this but it looks like things have moved pretty firmly into the realm of a feature request now. Is it necessary to post a new topic or is there a way to just move this whole thread to the developer forum?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Non-destructive conversion of JPEGs to multi-page TIFF
I suggest you put a new post in the developers forum with a sentence describing your request and a link to this post.
snibgo's IM pages: im.snibgo.com
-
- Posts: 6
- Joined: 2013-09-04T18:56:41-07:00
- Authentication code: 6789
Re: Non-destructive conversion of JPEGs to multi-page TIFF
Thanks.
I guess for continuity's sake here's the link to the new post in the developer forum.
viewtopic.php?f=2&t=24096
I guess for continuity's sake here's the link to the new post in the developer forum.
viewtopic.php?f=2&t=24096
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Non-destructive conversion of JPEGs to multi-page TIFF
IM relies upon the tiff delegate library. So you really need to take that up with the tiff development team. If it is included in libtiff, then perhaps IM can utilize it. But until then, it is not likely an IM issue.I would be eternally grateful if this could be implemented in IM