How do I create *.jp2-file with pre-made tiles

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
royeven
Posts: 4
Joined: 2013-05-03T16:31:57-07:00
Authentication code: 6789

How do I create *.jp2-file with pre-made tiles

Post by royeven »

Hi. I have six image files I want to make a montage of. Each file is downloaded from the net is 1024x1024 pixels in size. They are named A1, A2, B1, B2, C1, C2, and I want the montage to look like this:

Code: Select all

|--------|--------|
| A1.jpg | A2.jpg |
|        |        |
|--------|--------|
| B1.jpg | B2.jpg |
|        |        |
|--------|--------|
| C1.jpg | C2.jpg |
|        |        |
|--------|--------|
However, my original files are already JPEG-compressed, and I do not have the original files available. I don't want to lose quality when making the montage, so I want the output format to be something lossless. I know that I can use the command

Code: Select all

montage `ls *.jpg | sort` -geometry +0+0 -tile 2x3 -border 0 -frame 0 "montage_geom.png"
to make a lossless png file. But the original jpeg's are a total of 632kB and the resulting png-file is 6MB, or 10 times as big.

I have heard that jpeg2000 are made from tiles, where each tile is compressed individually. Is there a way to stitch these six files together into one, while still retaining all the information in the originals (i.e. not re-encode the information) and keeping the file size at about 650kB?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How do I create *.jp2-file with pre-made tiles

Post by snibgo »

ImageMagick doesn't have a way to do that. IM works by decompressing all the pixels, doing any required work, and re-compressing.
snibgo's IM pages: im.snibgo.com
royeven
Posts: 4
Joined: 2013-05-03T16:31:57-07:00
Authentication code: 6789

Re: How do I create *.jp2-file with pre-made tiles

Post by royeven »

I was afraid of that. After some research I found a different way to do it:
Jpegtran is a program that stitches together two jpegs in a way that they claim is lossless, and from my investigations seems to be.
http://jpegclub.org/jpegtran/.
Post Reply