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

Notification

Icon
Error

#gm5 #obsolete

Options
Go to last post Go to first unread
eddieharary  
#1 Posted : Thursday, December 9, 2010 7:48:23 AM(UTC)
eddieharary

Rank: Member

Groups: Member
Joined: 8/22/2006(UTC)
Posts: 7

Thanks: 1 times
I have a few hundred psd files with white backgrounds that I need to convert to png with a transparent background. Is there any example of how to do that using a win form? I don't need to show it to the user, just convert and save with the same filename and .png extension.

Thanks,

Eddie

Edited by moderator Monday, May 28, 2012 8:24:42 PM(UTC)  | Reason: Not specified

Dmitry.Obukhov  
#2 Posted : Friday, December 10, 2010 6:33:28 AM(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 Eddie,

Thanks for contacting us.

Please use this code to convert PSD files to PNG:

Code:

Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap();
bitmap.ColorManagement.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms;
PsdReader PSD = new PsdReader(@"C:\temp\test2.psd");
IFrame PSDFrame = PSD.LoadFrame(0);
PSDFrame.GetBitmap(bitmap);
bitmap.Channels.Transparentize(Aurigma.GraphicsMill.Color.FromRgb(255, 255, 255), 0);
bitmap.Save(@"C:\temp\test2.png"); 

If you have any additional questions please feel free to let me know.

Best regards,

Dmitry Obukhov

Technical Support. Aurigma, Inc.

eddieharary  
#3 Posted : Friday, December 10, 2010 11:39:23 AM(UTC)
eddieharary

Rank: Member

Groups: Member
Joined: 8/22/2006(UTC)
Posts: 7

Thanks: 1 times
Hi Dmitry,

It works great. Below is the code you gave converted to VB in case anyone else needs it.

Thanks!

Eddie

Dim bitmap As New Aurigma.GraphicsMill.Bitmap

bitmap.ColorManagement.ColorManagementEngine=Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms

Dim PSD As New Aurigma.GraphicsMill.Codecs.PsdReader("D:\test2.psd")

Dim PSDFrame As Aurigma.GraphicsMill.Codecs.IFrame

PSDFrame = PSD.LoadFrame(0)

PSDFrame.GetBitmap(bitmap)

bitmap.Channels.Transparentize(Aurigma.GraphicsMill.Color.FromRgb(255, 255, 255), 0)

bitmap.Save("D:\test2.png")

Dmitry.Obukhov  
#4 Posted : Friday, December 10, 2010 8:28:30 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)
Hi Eddie,

Thanks for your comment, and VB code.

Best regards,

Dmitry Obukhov

Technical Support. Aurigma, Inc.

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.