Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Square Crop in GraphicsMill LosslessJpegTransform
Rank: Newbie
Groups: Guest
Joined: 9/12/2008(UTC) Posts: 1
|
I need to produce a square thumbnail image. I'm using the WriteCropped method. When I first call AlignToSampleSize with my (square) Rectangle. It returns a non-square. Is it possible to use AlignToSampleSize and WriteCropped to force a square crop?
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Hello Paul, To crop image with square, you can use juts WriteCropped method defining x, y coordinates of left top corner, and crop size: Code:
Aurigma.GraphicsMill.Codecs.LosslessJpegTransform losslessJpeg = new Aurigma.GraphicsMill.Codecs.LosslessJpegTransform(@"C:\1.jpg");
losslessJpeg.WriteCropped(@"c:\2.jpg", new System.Drawing.Rectangle(0,0,200,200));
losslessJpeg.Close();
or Crop method of Transforms class: Code:
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap");
Aurigma.GraphicsMill.Codecs.JpegReader jpegReader = new Aurigma.GraphicsMill.Codecs.JpegReader(@"C:\1.jpg");
using (Aurigma.GraphicsMill.Codecs.IFrame frame = jpegReader.LoadFrame(0))
{
frame.GetBitmap(bitmap);
}
bitmap.Transforms.Crop(new System.Drawing.Rectangle(0, 0, 200, 200));
Aurigma.GraphicsMill.Codecs.JpegEncoderOptions encoderOptions = new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(100, true);
bitmap.Save(@"C:\2.jpg", encoderOptions);
|
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
|
|
|
Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Square Crop in GraphicsMill LosslessJpegTransform
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.