Does anybody know of a really good Xojo class for thumbnails. I’ve tried FGThumbnailCanvas but I cannot work out how to edit thumbnail items for the array of thumbnails. It would be nice to have multiselect, and drag and drop capabilities. It would be nice if it was free. But please only tell me about the best, free or paid-for.
Thanks
Sounds like this wouldn’t be a perfect fit, but you can check it out regardless: http://thezaz.com/code/zirconkit/cropper/
Oh you know what, I think you’re looking for something to display an array of thumbnails, not create thumbnails. My mistake, disregard.
What is Your target platform. Windows or OS X?
Indeed, Mac or Windows? On Mac, you can use CGImageSource to very quickly extract thumbnails. Windows… I don’t know enough, except perhaps to try and read the meta data.
On Windows I use the FGThumbnailCanvas without any problems. But I don’t use drag and drop. On Mac I use the native IKImageBrowserView via MBS for displaying the thumbs.
For creating thumbs I use also the MBS plugins with the following code:
' nThumbsize=256
dim g as FolderItem
dim ji as JPEGImporterMBS
dim je as JPEGExporterMBS
dim cTemp, cNewFile as string
dim nFaktor as Double
dim nWidth, nHeight as integer
dim p as picture
g=GetFolderItem(yourImageFile)
#if targetMacOS then
dim c as new CGImageSourceMBS(g)
dim img as CGImageMBS
dim d as new Dictionary
d.Value(c.kCGImageSourceThumbnailMaxPixelSize)=app.nThumbSize
d.Value(c.kCGImageSourceCreateThumbnailFromImageAlways)=True
d.Value(c.kCGImageSourceCreateThumbnailWithTransform)=True
'd.Value(c.kCGImagePropertyExifDateTimeOriginal)=""
img = c.CreateThumbnailAtIndex(0, d)
p = img.Picture
#else
ji=new JPEGImporterMBS
ji.File=g
'j.ReadMarkers=true
ji.AllowDamaged=true
if ji.ReadHeader then
if ji.Width > 4000 then
ji.ScaleFactor=8
end if
end if
ji.Import
nWidth = ji.Width
nHeight = ji.Height
if (nWidth = 0) or (nHeight=0) then // Division durch Null, leeres Bild
return -6
end if
p = ji.Picture
if nWidth > nHeight then
nFaktor = (nHeight/nWidth)
p = p.ScalingMBS(app.nThumbKompression, app.nThumbSize ,(app.nThumbSize*nFaktor))
else
nFaktor = (nWidth/nHeight)
p = p.ScalingMBS(app.nThumbKompression, (app.nThumbSize*nFaktor), app.nThumbSize)
end if
#endif
if (p <> nil) and (p.Width > 0) then
if utils.DateiExt(cDatei) = "JPG" then
cTemp = cNewFile + cDatei
else
cTemp = cNewFile + utils.DateiOhneExt(cDatei)+".JPG"
end if
h=GetFolderItem(cTemp)
je=new JPEGExporterMBS
je.File=h
je.Quality=75
je.HorizontalResolution=100
je.VerticalResolution=100
je.Picture=p
je.Export
else
utils.MsgDlg "error..."
return -7
end if
end if
p = nil
return 0
Yup CGImageSource is so wickedly fast, and it’s even faster when accessing images that are in your iPhoto/Aperture library so Apple do even more magic!
for making a thumbnail and saving it to a file which is the better method and why
MBS method or ?
CBImageSource ?
CGImageSourceMBS in MBS Plugin can be used and is quite fast on Mac.
For Linux and Windows you need something different.
For JPEGImporterMBS we have flags which allow you to read every nth Pixel only and get a smaller picture faster without decompressing all data.
I found that GraphicImagick by MBS is an easy plugin to use for Thumbnails