Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ChingYen  
#1 Posted : Thursday, April 11, 2013 2:02:54 AM(UTC)
ChingYen

Rank: Advanced Member

Groups: Member
Joined: 3/3/2008(UTC)
Posts: 185

Thanks: 8 times
Hi,

We tried to use multilayer viewer to save the artwork

Code:
_mlvMain.RenderWorkspace(300).Save(System.IO.Path.Combine(outputPath, "Page" + i.ToString() + ".jpg"), new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(100, true));

Follow by rotating it

Code:

                                Aurigma.GraphicsMill.Codecs.LosslessJpegTransform losslessJpeg = new Aurigma.GraphicsMill.Codecs.LosslessJpegTransform(fullFilePath);
                                losslessJpeg.WriteRotated(fullFilePath + ".tmp", System.Drawing.RotateFlipType.Rotate90FlipNone);
                                losslessJpeg.Close();
                                losslessJpeg.Dispose();
                                System.IO.File.Delete(fullFilePath);
                                System.IO.File.Move(fullFilePath + ".tmp", fullFilePath);

However, we found that, after rotate, the file dimension no longer the same.

Example: the photo was 1606x1134, but, after rotate, it became 1120 x 1606

Kindly advise on how to avoid this. Thanks.

ChingYen attached the following image(s):
Page1.jpg
Dmitry  
#2 Posted : Friday, April 12, 2013 11:06:04 AM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello Ching-Yen,

It is supposed to work this way. Any JPEG image is built of blocks of pixels called MCUs (Minimum Coded Units). Typically MCU size is a number divisible by 8. Lossless rotation rearranges MCU blocks and pixels of each MCU in a new order. If an image width or height is non-divisible by MCU size, then lossless rotation will crop the image (Applying Lossless JPEG Transforms). Typically you lose from 0 to (MCU size - 1) pixels of your image.

Unfortunately this is a tradeoff. Either you get fast rotation and better quality of JPEG images but images are slightly cropped or you decompress image, rotate it and save it back to JPEG.

Edited by user Friday, April 12, 2013 11:10:13 AM(UTC)  | Reason: Not specified

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
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.