Rank: Newbie
Groups: Guest
Joined: 9/14/2021(UTC) Posts: 1
|
Code: private static void MergeAndResize()
{
int x = 400;
int y = 100;
using (var psdReader = new PsdReader(@"C:\Users\jrajagopalan\source\repos\PSDTestPicture\Stonefire.psd"))
using (var resize = new Resize(x, y, ResizeInterpolationMode.High))
using (var writer = ImageWriter.Create(@"C:\Users\jrajagopalan\source\repos\PSDTestPicture\output\BusinessCard_Resize.png"))
{
resize.Receivers.Add(writer);
psdReader.MergeLayers(resize);
}
}
Edited by moderator Tuesday, September 14, 2021 9:15:39 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Please add ColorConverter to explicitly convert the image to the pixel format supported with the target PNG file format. Code: private static void MergeAndResize()
{
int x = 400;
int y = 100;
using (var psdReader = new PsdReader(@"C:\Users\jrajagopalan\source\repos\PSDTestPicture\Stonefire.psd"))
using (var converter = new ColorConverter(PixelFormat.Format32bppArgb)
using (var resize = new Resize(x, y, ResizeInterpolationMode.High))
using (var writer = ImageWriter.Create(@"C:\Users\jrajagopalan\source\repos\PSDTestPicture\output\BusinessCard_Resize.png"))
{
converter.Receivers.Add(resize);
resize.Receivers.Add(writer);
psdReader.MergeLayers(converter);
}
}
P.S. Please note, the code is untested. Edited by user Tuesday, September 14, 2021 9:16:07 PM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|
|
|
|
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.