Actually the most 'spec' thing to do is the same as what IM does for handling failed crop images. Create a one pixel transparent "miss" image, but that is not always a desirable thing to do either!
See IM example, Animation Modifications, Reposition Animation Frames
http://www.imagemagick.org/Usage/anim_m ... e_relative
This has an example that actually generates a incorrect image of this type!
NOTE this is more of something that highlights image handling bugs in programs. Firefox handles it fine, IE does not. Really, any applications should be checking for 'problems' like this any way! IM does, and you can force this with -repage 0x0 (which is illogical!)
Page, Repage, and the Virtual Canvas
http://www.imagemagick.org/Usage/basics/#page
Images with negative or large offsets are actually very useful with layering image. Typically the layered image does not need or desire any sort of virtual canvas size, as the processing is not finalised. The image is still in an intermediate state.
Negative or large position offsets are common in image composition, though they typically use gravity effected geometry, rather than 'layer offsets', even in the simplest of cases..
See second example of 'over' compose method....
http://www.imagemagick.org/Usage/compose/#over
Distorted images are very often 'illegal' in its positioning. It is just a useful thing to do.
For example... Arc Center Point Placement
http://www.imagemagick.org/Usage/distorts/#arc_center
A better example of this is the older examples from: Affine Matrix Processing, Positions of Results
http://www.imagemagick.org/Usage/affine/#affine_pos
IN this I use some code to generate a special 'viewport' image so as to demonstrate the actual image positions.
Shadow image generation can also generate negative offset images...
http://www.imagemagick.org/Usage/blur/#shadow
Without it, shadow can not be positioned correctly relative to the input image!
The
-layers merge operator was specifically designed to deal with images with negative positions. Especially those generated by distort and shadows, but also for 'layer arrangements'
See Programmed Positioning of Layered Images
http://www.imagemagick.org/Usage/layers/#layer_prog
In summary... many Layering image technqiues will generate images that have bounds that fall outside a 'virtual canvas' This is especially the case with negative offsets, as a virtual canvas is only defined as being from the origin, to the positive size.
GIF is probably the worst in it handling of layer offsets. the image file format does not allow for negative offsets at all.. the value is unsigned, so negative offsets get clipped to zero!
PNG, and MIFF images can handle with negative or large offsets fine. In fact default PNG does not even have a 'canvas' part to the image file format, that was added by IM when it saves images. Though I would not like to display those images in a web browser until the image is made a little more 'presentable'.
In most cases is the canvas is not defined (or set to 0x0) IM will try to define a 'logical' canvas that best fits the image and its offset, though that is not possible with negative offsets, so it has a minimum canvas size of the image size.