How to cut 1 large Image to multi Images with A4 size

Jan 11, 2011 at 1:15 PM

Hi all,

How can I cut a large image to multi images with A4 size, because I need convert this image to PDF.

If Image to large, PDF dose not display all content.

Thank you.

Jan 13, 2011 at 10:40 AM

Hi All

Is there anyway to crop a Image to Multi Image

Thank you.

Coordinator
Jan 20, 2011 at 3:23 PM

Hi,

sorry I had less time the last days.

Lets say we have 72 dpi which means 28,5 pixel per cm and a image in A4 must have about (21 cm * 28.5 pixel / cm) x (29.7 * 28.5 pixel / cm) = 598.5 x 846.45 pixel = 598 x 846 pixel.

You can calculate the A4 images like this:

int a4Width = 598;
int a4Height = 846;

for (int y = 0; y < image.Width / a4Width; y++)
{
    for (int x = 0; x < image.Width / a4Width; x++)
    {
        Rectangle rect = new Rectangle(x * a4Width, y * a4Height, Math.Min(a4Width, image.Width - x * a4Width), Math.Min(a4Height, image.Height - y * a4Height));

        ExtendedImage currentA4Image = ExtendedImage.Crop(image, rect);
    }
}

The code is not tested, but I think it should work.

Coordinator
Jan 20, 2011 at 3:25 PM

Btw: Can you tell me, when the code works, then I can add it to the library as extension method.

Mar 4, 2014 at 6:21 AM
I never try to cut one large image onto several small image files, I only tested to cut a imge file, such as multi-page tiff file into multiple sub-tiff images by using a tiff merging tool within my document image managing system, it works very easily and costs me a little time.
May 5, 2014 at 3:06 AM
IMAGETOOLS
To cut a large image to multi images or crop image to multi images, you may need image splitting features. Not sure whether it is supported or not.