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

Notification

Icon
Error

Options
Go to last post Go to first unread
himmelroman  
#1 Posted : Monday, June 20, 2011 1:08:38 PM(UTC)
himmelroman

Rank: Newbie

Groups: Member
Joined: 6/20/2011(UTC)
Posts: 1

Hi,

I am trying to implement simple Rotate & Crop functionality.
I got everything working using the samples, but I can't seem to solve one issue.

When I rotate an image (using Bitmap.Transforms.Rotate),
there are actually two effects - the image is rotated and downsized to fit in the original square.
What I would like to happen instead - is that the image will get "cropped" on the edges
(or more precisely - the edges will be hidden, as if they are outside the original display border).

Just the effect that would happen if you put a printed photo on a table, look at it through a fixed frame and rotate the photo on the table. Parts of it should get outside the frame (Until it comes to 180 degrees and back at 360 degrees again).

Is there a way to implement this?



Thank you in advance,
Roman.

Edited by user Monday, June 20, 2011 1:14:57 PM(UTC)  | Reason: Not specified

himmelroman attached the following image(s):
Original.jpg
Desired.jpg
Rotated using Aurigma.jpg
Dmitry.Obukhov  
#2 Posted : Wednesday, June 22, 2011 8:30:39 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Hello Roman,

Sorry for this delay.
Unfortunately, it is not possible to implement this functionality to hide or crop image edges while rotating it.
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
JWPlatt  
#3 Posted : Monday, June 27, 2011 11:15:49 AM(UTC)
JWPlatt

Rank: Newbie

Groups: Member
Joined: 1/29/2011(UTC)
Posts: 2

In a related question, how can we rotate and have the image within stay the same size (bitmap size increases to contain the rotated image) instead of being reduced?

By the way, himmelroman could do this, then crop with a black background to get the desired effect.

Edited by user Monday, June 27, 2011 11:17:53 AM(UTC)  | Reason: Not specified

Dmitry  
#4 Posted : Wednesday, June 29, 2011 4:25:15 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,

Unfortunately Dmitry was wrong in his reply.

When Graphics Mill rotates an image, linear image dimensions remain the same as in original one. Downsize operation doesn’t happen in this case. The component rotates the image and overlays it with background of specified color.

Here is the code which rotates a photo and crops it. I hope it’s exactly what you need.
Code:

Aurigma.GraphicsMill.Bitmap src = new Aurigma.GraphicsMill.Bitmap(@"C:\Temp\DSC03440.JPG");
int width = src.Width;
int height = src.Height;

src.Transforms.Rotate(45f);
src.Transforms.Crop((src.Width - width) / 2, (src.Height - height) / 2, width, height);

src.Save(@"c:\temp\rotate.jpg");

Edited by user Wednesday, June 29, 2011 4:38:42 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.