Page 1 of 1
Merge smaller images onto large base image
Posted: 2013-04-20T05:48:50-07:00
by minchadw
I don’t know if IM is the API environment to do this, I would appreciate feedback if yes or go to another type of platform.
Require a web-based application. Required to load and interactively view a large(ish) PDF/TIFF or Geo PDF of about 100MB. Users need to interactively upload, drag/drop smaller image(s) – say personal photos (1MB jpgs) onto the base image, then save as merged image file.
Does IM manage the sampling of a large file to handle display over the web, or do I create lower resolution version of the base image to display to the user for interaction? If I user lower resolution, I need to then be able to use registration coordinates to merge the smaller images onto 100MB base image. Is IM the API to work this?
thx
Re: Merge smaller images onto large base image
Posted: 2013-04-21T19:42:56-07:00
by anthony
IM can do the resampling to low resoultion, and can even output the images from PHP.
See Resize
http://www.imagemagick.org/Usage/resize/
It can overlap the smaller images on the larger images
See Layering Images http://**removed**/~anthony/im/layers/
Later examples even show programmed arranging of multiple sub-images
But it can not gather the 'registration coordinates' from a user (that is up to the interface)
It can use those coordinates though.
Re: Merge smaller images onto large base image
Posted: 2013-04-22T02:34:03-07:00
by minchadw
Yes, I see IM has great options for resizing my original image to a size for web viewing.
From your comments, can I conclude that an app has access to the location info for the overlayed images?
An example
Base image = 64000 x 48000px
Resized image viewed in web app = 640 x 480px
Use interactively uploads image1 dragged on resized base image. I'm assuming then the api will know coordinates or attachment point for image1 relative to the resized image?
Then its a matter of taking those coordinates, reverse engineer to fit on the original base image coordinate system, and then overlap/write image1 to the base?
Re: Merge smaller images onto large base image
Posted: 2013-04-22T19:27:46-07:00
by anthony
Yes that seems the right way to do it.
Once you have the coordinates adjusted for you internal source image, you can 'compose' the two together.
Note that both images need to be scaled similarly on the display. -resample can resize images based on the 'resolution' or DPI of the image to that of the display. Or you can resize both using a '%' scaling factor. eg '10%' That way you keep the two images in sync for display.
POINT... -resize will resize images imperfactly. That is the final size will be rounded to the nearest integer.
However resizing using -distort will resize perfecty to the scale you specify, around the point (handle) you specify. The cost is the addition of 1 or two extra (typically transparent) pixels around the edges.
http://www.imagemagick.org/Usage/resize/#distort
But it is slower as it does cylindrical area resampling.
Re: Merge smaller images onto large base image
Posted: 2013-04-22T21:43:51-07:00
by snibgo
minchadw wrote:Base image = 64000 x 48000px
This will need lots of memory, of course. Around 18 GB, and probably the same again.
Re: Merge smaller images onto large base image
Posted: 2013-05-04T11:57:22-07:00
by minchadw
anthony wrote:IM can do the resampling to low resoultion, and can even output the images from PHP.
See Resize
http://www.imagemagick.org/Usage/resize/
It can overlap the smaller images on the larger images
See Layering Images http://**removed**/~anthony/im/layers/
Later examples even show programmed arranging of multiple sub-images
But it can not gather the 'registration coordinates' from a user (that is up to the interface)
It can use those coordinates though.
I'm interested in the multiple sub-images. Can you check your Layering Images link above, I don't have permission to read....thx
Re: Merge smaller images onto large base image
Posted: 2013-05-05T21:58:28-07:00
by anthony
Applogies
http://www.imagemagick.org/Usage/layers/
The other link is a restricted test server