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 : Monday, March 17, 2008 11:46:37 AM(UTC)
ChingYen

Rank: Advanced Member

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

Thanks: 8 times
Hi,

I am trying to let my user right click and rotate a picture then save to the same file. I was trying to use the LossLessJPegTransform, but, seems like i got no luck on it. Please advice.

Code:
Dim jpg As New Aurigma.GraphicsMill.Codecs.LosslessJpegTransform(_item.Pidl.Path)
jpg.WriteRotated(_item.Pidl.Path, RotateFlipType.Rotate270FlipNone)
jpg.Dispose()

Error:

"Unable to save data to file 'C:\Documents and Settings\User\My Documents\My Pictures\T3\DSC06675.JPG'. The process cannot access the file because it is being used by another process. "

Edited by user Wednesday, March 26, 2008 8:47:35 PM(UTC)  | Reason: Not specified

Alex Kon  
#2 Posted : Tuesday, March 18, 2008 8:43:58 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi,

Current version of the Graphics Mill for .NET doesn't allow to use the same file as source and destination file (it is not very convenient, but this restriction guarantees that it is impossible to corrupt file in case of any unexpected errors during transforming).

You should save transformed image to a temporary file and then replace original file with new one.

ChingYen  
#3 Posted : Tuesday, March 18, 2008 8:47:16 PM(UTC)
ChingYen

Rank: Advanced Member

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

Thanks: 8 times
Alex Kon wrote:
Hi,

Current version of the Graphics Mill for .NET doesn't allow to use the same file as source and destination file (it is not very convenient, but this restriction guarantees that it is impossible to corrupt file in case of any unexpected errors during transforming).

You should save transformed image to a temporary file and then replace original file with new one.

Would like to check if the lossless file save will be faster than the ordinary file save? or will be the slower? Please advice.

Alex Kon  
#4 Posted : Wednesday, March 19, 2008 2:16:56 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi ChingYen,

LosslessJpegTransform will be faster in the most popular scenarios. But, what is much more important, it doesn't recompress JPEG image, so it provides better-quality output. So, if it is possible in your application, I recommend you to use LosslessJpegTransform.

Alex Kon  
#5 Posted : Wednesday, March 19, 2008 3:17:32 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Oh, just if you are interested in more detailed information:

If to speak about performance only, not taking quality into account at all, you may wonder when JpegWriter will be faster.

It will be in case when you load image one time and then save it multiple times. Therefore your application will perform following actions: load, rotate, save, save, save, save.

While LosslessJpegTransform always reads source file and then writes the result, so it will be: load, saveRotated, load, saveRotated, load, saveRotated, load, saveRotated - 8 actions instead of 6 in the example above.

But (again! ;)) - it is rare case when you will just save the same image multiple times. More common scenario is something like that: load, flip, save, crop, save, rotate, save, anotherFlip, save - 9 actions. LosslessJpegTransform will perform 8 actions to get the same result.

And - not the only action count is important. JpegTransform always has to read/write data from/to the disk, it is much slower than operations on Bitmaps in memory. But from the other hand, LosslessJpegTransform doesn't actually decode JPEG blocks - so it avoids a lot of calculations in his work.

The idea is that you always should profile your application in your enviroment before optimization. In my tests I have got different results - depending on the source image size and set of used transforms.

Our team is always ready to answer your questions, and the more information you provide, the better answers we give ;) Otherwise we are able to give only most common advices.

ChingYen  
#6 Posted : Wednesday, March 19, 2008 4:27:29 PM(UTC)
ChingYen

Rank: Advanced Member

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

Thanks: 8 times
Hi,

Thanks for the answer. But, it would be really appreciate if we could direct write back to the same picture.

Perhaps this feature could be up sometime in near future.

Alex Kon  
#7 Posted : Monday, March 24, 2008 6:21:36 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi,

We will surely discuss your request, but I cannot give any promises about schedule of this feature, sorry!

If it is not acceptable for you to use interim files or if you need any assistance - feel free to post your questions here or submit case.

Edited by user Thursday, May 22, 2008 2:12:36 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Similar Topics
LosslessJpegTransform will discard ICC Profile? (Discussions – Graphics Mill)
by ChingYen 5/16/2013 8:06:54 PM(UTC)
Square Crop in GraphicsMill LosslessJpegTransform (Discussions – Graphics Mill)
by pauljdonohue 6/14/2011 3:31:33 PM(UTC)
INFO: ThumbnailListView Does Not Display JPEG Images Modified Using LossLessJpegTransform Correctly (Archive - Graphics Mill)
by ChingYen 4/5/2008 1:55:29 PM(UTC)
Using LosslessJpegTransform (Discussions – Graphics Mill)
by bdavi19 3/23/2006 2:52:36 AM(UTC)
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.