Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting pixel in JPG
Message
 
 
À
09/09/2005 13:58:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Divers
Thread ID:
01048135
Message ID:
01048234
Vues:
19
This message has been marked as the solution to the initial question of the thread.
>>Anyway, I'd take another approach to the problem, and it is drawing the border right away. If the image already have it, it doesn't hurt.
>
>Interesting, I'll wait for the code.

Here is it (still waiting for the meeting to start...):
Lparameters tcFullPath as String 

If not File( tcFullPath )
	RETURN
EndIf 

* Get the "GDI+ Image class" from UT Downloads!
* Thanks to Alexander Golovlev for it!

#INCLUDE gpImage.h
#DEFINE BLACK 0

Copy File ( tcFullPath ) to before.jpg

If PemStatus( _Screen, "imgBefore",5 )
Else 
	_screen.AddObject("imgBefore","Image")
EndIf 
_screen.imgBefore.Visible= .t.
_screen.imgBefore.Picture = "before.jpg"


Local gdi as gpInit of gpImage.prg, img as gpImage of gpImage.prg

gdi = NewObject("gpInit",  "gpImage.prg")
img = NewObject("gpImage", "gpImage.prg")

img.Load("before.jpg")

? img.ImageFormat, img.PixelFormat
? img.ImageWidth, img.ImageHeight
? img.HorizontalResolution, img.VerticalResolution

* Creates a black border
For i = 0 to img.ImageWidth-1
	img.SetPixel(i, 0, BLACK)
	img.SetPixel(i, img.ImageHeight-1, BLACK)
Next

For i = 0 to img.ImageHeight-1
	img.SetPixel(0, i, BLACK)
	img.SetPixel(img.ImageWidth-1, i, BLACK)
Next

img.SaveAsJpeg("after.jpg")

If PemStatus( _Screen, "imgAfter",5 )
Else 
	_screen.AddObject("imgAfter","Image")
EndIf 
_screen.imgAfter.left = 200
_screen.imgAfter.Visible= .t.
_screen.imgAfter.Picture = "After.jpg"

Return 
You can use the _FCC classes to do the same. I just started using Alexander's class a few years ago and reclled I have samples more handy.

Hope this helps,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform