Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GDI+ Image Sizes
#1
So I created a .png file that is a 100px by 100px black box and saved it as BOX100.png

Then I used GDIP.GdipDrawImageI to draw that box into an empty GdipGraphics object and save...when I open the file the box is 32px by 32px...odd.

Function Function5
Code:
Copy      Help
#compile "__Gdip"


str BOX="$desktop$\BOX100.png"

;create empty destination image
GdipBitmap b.CreateEmpty(100 100) ;;used to draw images and save
GdipGraphics g.FromImage(b) ;;need for GDIP functions
GdipImage im.FromFile(BOX)

GDIP.GdipDrawImageI g im 0 0

if(!b.Save("$desktop$\BOX.png")) end "saving"


Attached Files Image(s)
   
#2
Definitely has something to do with the PNG file.

I was able to get things working the way I'd expect them to with a gif file.

I suspect it has something to do with the bit depth...I played around with the settings of the png file, but no luck.

I'll use gifs for now, but I'd like some input on how to get the behavior of png files to work.

_jim
#3
Definitely it relates to the bit depth color.
Your original PNG file has just 1-bit color depth
I've tried to test with a 24-bit color depth and it works just fine.
I've attached my PNG test file here for comparison.


Attached Files Image(s)
   


Forum Jump:


Users browsing this thread: 1 Guest(s)