Free Support Forum - aspose.com

Get Thumbnail JPEG Preview Image of an Entry in RAR ZIP ISO or 7z Archive (C# .NET)

Hi, Support:
Does the zip.dll support getting the Thumbnail of an entry for preview?
----------it demo codes as follow-------------------
Dim ZipArchive As Archive = New Archive(Filepath)
ZipArchive.Entries(0).Extract(AppPath & “\Temp.jpg”)
Dim Image As Bitmap = GetThumbnail(AppPath & “\Temp.jpg”)
PictureBox1.picture = Image

Does the zip.dll support this: Dim Image As Bitmap = ZipArchive.Entries(0)…GetThumbnail() ??

@ducaisoft,

We have logged your requirement in our issue tracking system. Your ticket number is ZIPNET-676. We will further look into the details of this requirement and will keep you updated on the status of the linked ticket.

Thanks for your concern about this issue.
if possible, we hope:
The zip.dll can get the thumbnail of each entry in rar/zip/iso/7z archive
the function of getting thumbnail may be :
Dim ThumbnailImage As Bitmap = Archive.Entries(0).GetThumbnail(Width,Height)
PictureBox1.picture = ThumbnailImage

@ducaisoft,

We have logged these details in our issue tracking system and will keep you posted here on any further updates.

@ducaisoft,

Regarding ZIPNET-676, I am afraid, we will not be able to provide facility to generate thumbnail picture for compressed images neither for other file entries in Aspose.ZIP API. But, you can choose a icon based on file extension using logic like that:

if (entry.Name.EndsWith(".exe")) { picture = "executable.ico" } 

We have investigated how to retrieve a thumbnail for existing file and you may get it after extraction. Attached is the sample project that can display thumbnail image for arbitrary file.

Thanks for your suggestion.
If the thumbnail image cannot be drawn within zip/rar package, an alternative method is to get it by file extension if the file is not picture and to get it by decompressing it to tempfile if the file is a picture type.
And your ShellThumbnail.zip can not be opened by VS 2017 after decompressing it, which reports like this “Project file is incomplete. Expected imports are missing”

Would you provide me it by Net version? or compile it exe file and provide me the exe file?
Thanks!

@ducaisoft,

In the project properties of “ShellThumbnails”, please just set Target Framework to “.NET Core 3.0”, rebuild it and run the Windows Form Application.

@ducaisoft,

We have also attached another application here for your reference that targets simple .NET Framework 4.5.2. It retrieve control panel icon for “C:\Windows\System32\control.exe” sample file.