Using ImageMagick to create fast composite images?
Posted: 2015-11-12T09:30:36-07:00
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.
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.