Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GDIplus to sharpen an image?
Message
De
14/02/2012 20:05:30
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Titre:
GDIplus to sharpen an image?
Divers
Thread ID:
01535423
Message ID:
01535423
Vues:
114
I have GDI+ working great for resizing images, but in doing so, the image loses a little sharpness, compared to using external tools like Irvanview to resize. Have any "sharp" minds out there found a way to "sharpen" an image slightly in VFP? TIA!

Here's the code I'm using to resize an image:
EXTERNAL CLASS _gdiplus		&& in home()+"ffc\"

#include "GdiPlus.h"		&& in ffc dir

m.loImage = CREATEOBJECT("GpImage")
m.loImage.CreateFromFile(m.tcImgFile)

m.loBitmap = CREATEOBJECT("GpBitmap")
m.lobitmap.create(m.lnW, m.lnH, GDIPLUS_PIXELFORMAT_24bppRGB)	&& 3rd param doesn't seem to make a diff

m.loGraphics = CREATEOBJECT("GpGraphics")
m.loGraphics.createFromImage(m.loBitmap)

m.loGraphics.InterpolationMode= GDIPLUS_InterpolationMode_HighQualityBicubic
m.loGraphics.SmoothingMode= GDIPLUS_SmoothingMode_HighQuality
m.loGraphics.PixelOffsetMode= GDIPLUS_PixelOffsetMode_HighQuality
m.loGraphics.CompositingQuality= GDIPLUS_CompositingQuality_HighQuality

m.loGraphics.drawImageScaled(m.loImage, 0, 0, m.lnW, m.lnH)

IF NOT m.loBitmap.SaveToFile(m.tcNewImgFile, "image/jpeg", "quality=90") OR;
	NOT FILE(m.tcNewImgFile)

	= dspmsg("!O", "Could not convert image to:^^" + m.tcNewImgFile)
	RETURN .f.
ENDIF
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform