XNA Strange blur on my transparency .png - xna

(i can't post images so i posted links instead)
i'm working on a 2D platform game using pixelperfect.
The problem is about the png images used in-game. On transparency, there are some blur.
like this :
http://i.stack.imgur.com/lBX3A.jpg
If i open the texture with TheGimp, this is what i get :
http://i.stack.imgur.com/pOeF4.jpg
this is a sample of my map (zoom 1600x).
As you can see there is no blur around the black. (the grey squares means transparency).
Tests i did :
save without compression and re-opened it = no blur.
to be sure, i added a white background in gimp (it's easier to see the dark blur on white) :
(http://) i.stack.imgur.com/jfhWv.jpg
of course, i removed the white background because i wanted it transparency.
last information : there is blur on every transparency png images, even on my spritesheet character. When i animate it, i can see the blur from others frames.
After my tests, i concluded that gimp isn't the problem.
Can you help me ? Thx for reading.
xna4, c#2010 express edition, gimp2.611.
Sorry about my english ^^

This happens because of "texture filtering", which xna does by default.
You probaly can disable this.
found something: https://gamedev.stackexchange.com/questions/6820/how-do-i-disable-texture-filtering-for-sprite-scaling-in-xna-4-0

Related

How to Add PNG Image as Button Image in CMFCToolBar?

Seems like CMFCToolBar Allowing only BITMAP Images ( which are of color depth 24 ) to place on Buttons. How to get rid of this limitation. i am neither able to place a PNG nor a bit map with color depth 32 (alpha channel included).
i tried attaching my CPngImage to CBitmap but didn't work.
CPngImage image;
image.Load(AfxGetInstanceHandle(), IDB_PNG1);
bitmap.Attach(image.Detach());
so, finally my doubt can we add a PNG/ Bitmap with alpha channel to CMFCToolBar Button as Image?
Does this work: Icons on menus of MFC Feature Pack classes ? You'd probably have to adapt it a bit to get it to work in your specific case. I'd suggest staying away from using PNG for toolbar icons etc; you can use AlphaConv (google a bit to find it - it moves around a bit it seems) to convert from png to 32 bit bmp.

XNA Texture2D.FromStream doesn't preserve color in fully transparent pixels

I'm using the color information in the texture still when the alpha is set to 0. The PNG file is correctly saved with the color preserved. If I use the content pipeline and set it to non-premultiplied, everything works fine. Texture2D.FromStream is documented as non-premultiplied but it's wiping out the color. When debugging in PIX and looking at the texture, all pixels with 0 alpha are set to black.
Is there a way I can bypass the content pipeline and still keep my color for transparent pixels?
I'm not able to help too much just now as I don't have code in front of me but I done this a few days ago myself and it had all the correct transparency that was expected. Perhaps it's your image that has an issue? I used a PNG saved using Paint.Net.
As seen in this image http://imgur.com/Qrqqo the boat, tree trunk and ladder all have transparency which allow them to be on a second layer and the tileset itself is loaded using from stream (User generated content ftw).
So if no-one has answered this before I get to my computer with code then I'll take a look at what I have and post a sample if needed.

Convert PNG32s to PNG8s and with matted indexed transparency

We have a range of product images that have been clear cut by our graphic designers and have been saved as PNG32s with transparent backgrounds. We need to convert these to PNG8 as they are uploaded to the website (using ImageMagick) so the files are nice and small.
The images are displayed at various positions over a grey gradient background so they need to retain their transparency.
Because the PNG8s will have indexed transparency, we want to matte just the semi-transparent anti-aliased edge pixels with the average grey of the gradient.
What's the nicest way of doing this im ImageMagic? I've found lots of cool ways of transforming/removing/flattening the alpha channel but it doesn't help much with the task of targeting and matting only semi-transparent pixels. Anyone done this before?

How to get great looking transparent PNGs on BlackBerry?

I am able to use PNGs that have drop shadows but the effect when displayed on the BlackBerry looks like it collapses the transparent channel down from its original smooth gradient to only several transparent values giving it a choppy look.
The same issue is encountered by drawing on the UI using BlackBerry fields or the graphics.drawBitmap method. Anyone want to share hints for getting great looking transparent effects on the BlackBerry?
Dither your images or pre-composite them. When loading an image on a BlackBerry, you get at most 4 bits of alpha data, which allows 4 bits each for RGB. So, if you want to dither your transparent images, go for RGB4444. If you don't dither them, that's what causes 8-bit alpha to just be mapped to the nearest 4-bit value.
If you include no alpha data (i.e., precomposite), you can get RGB565, which will have a better image quality overall, but you will have to deal with static positioning for your dropshadows.

Best way to programatically fill in a white border with a black border on images

I have over 100k in images that at one time were cropped and had a white border applied to them. I'm looking for the best way to programmaticly process each image so that I can detect the white borders and either crop the border or fill in the border with black instead. Would I need to use something like OpenCV or just plain old GDI? I've attached an image for reference.
What I have to work with (White borders are there, trust me):
http://cdn-images.hollywood.com/site/SO_3666231.jpg
Plain old GDI should work just fine, except for one thing - I don't know how to make GDI save an image back to a file. When I've had to do it in the past I've written a .BMP file in pieces, which wouldn't work for a JPEG. Time for a new question?
You're going to need a two step process - first measure the white borders, then copy the image to a new image to get rid of them.
Starting with a JPEG image introduces two small problems. First is that the image will contain some decoding artifacts, and white won't always be an RGB value of (255,255,255). You'll need to establish a threshold, such as (250,250,250) and see how that works; if it doesn't catch all of the borders, you'll need to try a lower threshold. Second is that resaving the image as a JPEG will introduce additional artifacts, lowering the quality of the image. Hopefully this will be within acceptable limits, but only you can be the judge of that.
I'm sorry that this isn't really an answer, perhaps more like 1/4 of an answer. I hope you find it useful.

Resources