JPEG Thumbnail
JPEG Thumbnail
Hello,
I wanted to load the embedded thumbnail of a JPEG image as fast as possible. I didn't find a way to do it. Indeed, CreateThumbnail and Create ThumbnailHQ seem to load the complete image and resized it, so it's not very efficient. Can someone guide me on how to do that ?
Many thanks.
Frédéric.
I wanted to load the embedded thumbnail of a JPEG image as fast as possible. I didn't find a way to do it. Indeed, CreateThumbnail and Create ThumbnailHQ seem to load the complete image and resized it, so it's not very efficient. Can someone guide me on how to do that ?
Many thanks.
Frédéric.
Re: JPEG Thumbnail
Hi Frédéric,
There is dedicated overloads of the CreateThumbnailHQ() method for such purpose:
from file
from stream
Hope this helps!
With best regards,
Loïc
There is dedicated overloads of the CreateThumbnailHQ() method for such purpose:
from file
from stream
Hope this helps!
With best regards,
Loïc
Re: JPEG Thumbnail
Hi Loïc,
CreateThumbnailHQ doesn't seem to "only" read the embedded thumbnail. First, we have to load the image to get imageId, then call the CreateThumbnailHQ. These operations takes too much time. Normally an extraction of embedded JPEG takes around 15 milliseconds which is not the case here. Moreother I don't know the size of the embedded thumbnail so I cannot give these informations to the parameters.
Normally, I use the following code:
Which works well, but I'm wondering if I can use GDPicture to replace this code.
Thanks.
Frédéric.
CreateThumbnailHQ doesn't seem to "only" read the embedded thumbnail. First, we have to load the image to get imageId, then call the CreateThumbnailHQ. These operations takes too much time. Normally an extraction of embedded JPEG takes around 15 milliseconds which is not the case here. Moreother I don't know the size of the embedded thumbnail so I cannot give these informations to the parameters.
Normally, I use the following code:
Code: Select all
using (FileStream stream = File.OpenRead(image.MediaPath))
{
BitmapFrame frame = BitmapFrame.Create(stream, BitmapCreateOptions.DelayCreation, BitmapCacheOption.Default);
if (frame.Thumbnail != null)
{
using (var fileStream = new FileStream(thumbnailPath, FileMode.Create))
{
BitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(frame.Thumbnail));
encoder.Save(fileStream);
}
}
}
Thanks.
Frédéric.
Re: JPEG Thumbnail
Hello Féréric,
I've edited my reply above. Please check the first link I've provided which target to the overload that creates a thumbnail image from a file path. There is no need to load the image from your side.
Let me know if this is still unclear.
With best regards,
Loïc
I've edited my reply above. Please check the first link I've provided which target to the overload that creates a thumbnail image from a file path. There is no need to load the image from your side.
Let me know if this is still unclear.
With best regards,
Loïc
Re: JPEG Thumbnail
Hello,
Well, I use the following code:
It works, but it generates a thumbnail instead of getting the embedded one. I saw that on the output high quality image and the time it takes to generate ( around 500ms ).
I've checked on disk and it saved a full resolution image size instead of the embedded thumbnail size.
So it doesn't seem to achieve what I want.
Frédéric.
Well, I use the following code:
Code: Select all
GdPictureImaging imaging = new GdPictureImaging();
int id = imaging.CreateThumbnailHQ(image.MediaPath, 0, 0, imaging.ARGB(255,255,0,0));
imaging.SaveAsBMP(id, thumbnailPath);
imaging.ReleaseGdPictureImage(id);
I've checked on disk and it saved a full resolution image size instead of the embedded thumbnail size.
So it doesn't seem to achieve what I want.
Frédéric.
Re: JPEG Thumbnail
Hello Frédéric,
Could you share the image you ware using?
If it contains confidential data you can sen it through https://www.gdpicture.com/support/getting-support-from-our-team
Loïc
Could you share the image you ware using?
If it contains confidential data you can sen it through https://www.gdpicture.com/support/getting-support-from-our-team
Loïc
Who is online
Users browsing this forum: No registered users and 2 guests