I have a web-based image renderer that is using ImageMagick for parts of it in the backend. Users can select images from a pre-defined list and essentially create a collage from them (I call it a composite image). I allow users to see a preview on the page of their creation and I also allow them to create a high res output later.
I want the low res preview to render as fast as possible! Right now it's taking a little while...And I've associated this with large images (large meaning file size, essentially) being utilized in the preview rendering. If I make low res versions of all my images and use only the low res version in my preview render, I'll save a lot of time on rendering.
The problem is, I need to support transparency. So while I want to make my low res images as small as possible (or at least, as small as I can without degrading the quality very significantly), there doesn't seem like an ideal format for this. At least with my limited knowledge!
- PNG should create rather large images (compared to a JPEG), so that's
not ideal.
- JPEG can't handle transparency, so that's not ideal.
- GIF only supports 1-bit transparency, so that's not ideal.
- TIFF creates rather large images, so that's not ideal.
- BMP is not even worth mentioning
- I doubt EPS or other vector formats will be ideal, but I'm only suspecting this because my output image is raster.
...and that exhausts my knowledge!
I am using ImageMagick for image conversion and I've a lot of success converting any image format to just about any image format. So, in theory let's say I'm allowed to use any image format to store my low res images as (I'm not limited to web formats, because these images all get rendered into a composite which is web friendly).
I am thinking that if the image a user selects is a JPEG, I'll just cache a low quality JPEG from it using ImageMagick. However, since detecting transparency in a large number of other image formats is likely a pain (does this sound like a good approach? Can ImageMagick do this?), I should blindly store all other image formats (that support transparency, anyway) as a low quality PNG. Does this sound like a good approach, or am I lacking in knowledge of a good image format which meets my needs?
Which is the best image format to store my low res images for creating one low res composite image? I'm currently of the mind that there isn't a single one, that I'll have to use a strategy of JPEGs and PNGs interchangeably.
Using ImageMagick to create fast composite images?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using ImageMagick to create fast composite images?
I think JP2000 format allows transparency. See https://en.wikipedia.org/wiki/JPEG_2000
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Using ImageMagick to create fast composite images?
Are these images essentially graphics (solid colours) or photos (noisy colours)? PNG is good for graphics, but large and slow for photos. For photos, TIFF is faster. I use ZIP compression.
For best speed, use one of IM's own formats: MIFF or MPC. These are specific to the Q-number of IM, and the version number, so you'll need to regenerate the images periodically.
As you are only reading the images, MPC is probably the fastest.
For best speed, use one of IM's own formats: MIFF or MPC. These are specific to the Q-number of IM, and the version number, so you'll need to regenerate the images periodically.
As you are only reading the images, MPC is probably the fastest.
snibgo's IM pages: im.snibgo.com
Re: Using ImageMagick to create fast composite images?
It varies, I'd say equally photos and equally graphics. Thanks for the quick responses, I'll do some research on JPEG 2000.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using ImageMagick to create fast composite images?
MIFF and MPC are not compressed (as far a I know). MPC writes a bit slow but reads very fast.
Re: Using ImageMagick to create fast composite images?
MPC is definitely interesting and it's interesting to try and think of a way to integrate it because of its performance, but not exactly viable for me, as I am essentially archiving low res images. I'd rather not have to regenerate them again. I have _a lot_ of images (in excess of several dozen TB) to cache and as always it keeps growing.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Using ImageMagick to create fast composite images?
MIFF does have compression, but no useful compression for photos. For graphics, the compression is useful. See my "Outputs: speed and size" page.
MPC has no compression.
I would not suggest either MIFF or MPC for archival usage, but only for "temporary" storage that can be re-created from master copies when desired.
MPC has no compression.
I would not suggest either MIFF or MPC for archival usage, but only for "temporary" storage that can be re-created from master copies when desired.
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: Using ImageMagick to create fast composite images?
MPC also is subject to Q level and version changes. For example MPC in IM 6 and IM 7 are different. So not good for long time storage.
I suspect JP2000 may be what you want if it supports 8-bit transparency and not 1-bit. I do not know.
I suspect JP2000 may be what you want if it supports 8-bit transparency and not 1-bit. I do not know.