Rank: Member
Groups: Member
Joined: 11/27/2003(UTC) Posts: 29
|
In trying to covert by Code: Dim gm As New GraphicsMill.Bitmap
gm.FormatAutoSelect = True
gm.LoadFromMemory(imgdata)
gm.Formats.SelectCurrent("JPEG")
Parameter to this subroutine - [imgdata() As Byte] I get an exception say that PSD is readonly format and cannot be converted. Is there a simple way to do this? Does TIFF conversion work the same. Thanks in advance Tom Edited by user Monday, December 24, 2007 4:44:54 PM(UTC)
| Reason: Not specified |
Tom Thorp Still waters, great photos
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
Hi Tom, What line are you getting an exception at? In fact the routine should be looking something like this: Code:Sub SaveAsJpeg(imgdata() As Byte)
Dim gm As New GraphicsMill.Bitmap
gm.FormatAutoSelect = False
gm.LoadFromMemory(imgdata)
gm.Formats.SelectCurrent("JPEG")
gm.SaveToFile "d:\filename.jpg"
End Sub
Imgdata can contain any file supported with Graphics Mill for loading. Edited by user Monday, December 24, 2007 4:45:05 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Member
Joined: 11/27/2003(UTC) Posts: 29
|
Thanks, code worked fine.
New Question, if upload PSD with color space set to adobe98, will GM convert to sRGB before changing JPEG or does it ignore color space in conversion? |
Tom Thorp Still waters, great photos
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
JPEG format supports both RGB and CMYK color spaces, and it also can embed color profiles. After it read PSD file, it won't convert anything, but save pixels and color profile as is. However you can force color conversion if you need: Code:...
objBitmap.Data.ColorManagement.IsEnabled = True
objBitmap.Data.ColorManagement.RgbProfile = Server.MapPath("sRgb.icc")
objBitmap.Data.ConvertTo24bppRgb
...
Hope this helps. Edited by user Monday, December 24, 2007 4:45:17 PM(UTC)
| Reason: Not specified
|
|
|
|
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.