This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
mohnston  
#1 Posted : Friday, June 26, 2020 5:57:38 AM(UTC)
mohnston

Rank: Newbie

Groups: Guest
Joined: 6/23/2020(UTC)
Posts: 5

Thanks: 1 times
I get the error "The specified pixel format is not supported." on the line: Pipeline.Run(reader + writer);
using (var writer = new GifWriter(gifFlyerPath))
{
writer.FrameOptions.Delay = 200;
for (int i = 0; i < pngFiles.Count; i++)
{
using (var reader = ImageReader.Create(pngFiles[i]))
{
Pipeline.Run(reader + writer);
}
}
}
The png files are created in WPF by rendering a Visual using:
RenderTargetBitmap bmr = new RenderTargetBitmap(
(int) adjustedWidth
, (int) adjustedHeight
, resolut
, resolut
, PixelFormats.Pbgra32);

bmr.Render(ThisDocument.Canvas_Base);

Bitmap bm = null;
using (MemoryStream stream = new MemoryStream())
{
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmr));
encoder.Save(stream);
bm = new Bitmap(stream);
var parms = new EncoderParameters(1);
parms.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);

string thisSlidePath = slidePath + sNo + ".png";
bm.Save(thisSlidePath , GetEncoder(ImageFormat.Png), parms);
pngFiles.Add(thisSlidePath);
sNo++;
}
Eugene Kosmin  
#2 Posted : Sunday, June 28, 2020 6:29:05 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Guest
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hello Mark,

GifWriter expects Indexed pixel format as an input. I guess BmpBitmapEncoder saves images in plain RGB format.

You can try to use the ColorConverter class to convert the image to Indexed format. Here is a small sample.

Best regards,
Eugene
Best regards,
Eugene Kosmin
The Aurigma Development Team
mohnston  
#3 Posted : Monday, June 29, 2020 12:30:53 PM(UTC)
mohnston

Rank: Newbie

Groups: Guest
Joined: 6/23/2020(UTC)
Posts: 5

Thanks: 1 times
The sample you referenced gave me a solution. Thank you.
Users browsing this topic
Guest
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.