Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Printing an image with different aspect ratio that the paper
Rank: Member
Groups: Guest
Joined: 7/25/2007(UTC) Posts: 3
|
Hi to all. Is there any automatic way to crop the image when it's going to be printed so it'd fill the whole paper? In example, if we're going to print an image with an aspect ratio of 4:3 in a paper of 4x6" (10x15 cm), the ImageFitMode can fit the image to the paper so the whole image fits in the paper, appearing white margins because of the difference of aspect ratio. Is there any way to avoid this, so the image fills all the paper, cropping the parts of the image that don't fit in? The standard ImageFitMode.CropToFit doesn't suit us because we need the picture to be resized to fit in the paper. This is a picture of an example: Thanks for your time.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hello Carlos,
Try to use ImageFitMode.ResizeToFill, I think that is what you need. |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 7/25/2007(UTC) Posts: 3
|
Thanks, Alex, but the image posted in the example was made with ResizeToFill. What I want is to resize the picture (preserving the aspect ratio) so won't appear white bands at the sides. It's a crop fitting one side of the picture to the size of the paper and cutting out the parts that doesn't fits in.
Is there any way to make this when printing?
Thanks again.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hello Carlos, Yeap, it seems that we have some inconsistent behaviour with print modes. Here is small code snippet which produces the desired result. It prints image on the default printer without any margins. Code:private void button2_Click(object sender, EventArgs e)
{
Aurigma.GraphicsMill.WinControls.ImagePrintDocument doc = new Aurigma.GraphicsMill.WinControls.ImagePrintDocument();
doc.Source = new Aurigma.GraphicsMill.Bitmap(@"E:\Pictures\TestSamples\Jpeg\Large.jpg");
doc.PlacementMode = Aurigma.GraphicsMill.WinControls.PlacementMode.SingleImage;
doc.PrintOptions.ImageFitMode = Aurigma.GraphicsMill.WinControls.ImageFitMode.ResizeToFill;
doc.QueryImage += new Aurigma.GraphicsMill.WinControls.QueryImageEventHandler(doc_QueryImage);
doc.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
doc.DefaultPageSettings.Landscape = false;
doc.Print();
}
void doc_QueryImage(object sender, Aurigma.GraphicsMill.WinControls.QueryImageEventArgs e)
{
Aurigma.GraphicsMill.WinControls.ImagePrintDocument doc = (Aurigma.GraphicsMill.WinControls.ImagePrintDocument)sender;
e.PrintPlaceholder.Location = new Point(0, 0);
e.PrintPlaceholder.Size = doc.DefaultPageSettings.Bounds.Size;
}
Edited by user Monday, December 17, 2007 7:31:54 PM(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 7/25/2007(UTC) Posts: 3
|
Thank you very much, Alex :)
This is exactly the effect I want.
Good bye and thanks again ;)
|
|
|
|
Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Printing an image with different aspect ratio that the paper
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.