GdiPlus::DrawImage stretches image after I have edited it with GIMP? - png

I use this code to draw a png into my device context:
auto_ptr<Gdiplus::Graphics> g(Gdiplus::Graphics::FromHDC(pDC->GetSafeHdc()));
g->DrawImage(pPng, xDest, yDest, xSrc, ySrc, nSrcWidth, pSrcHeight, Gdiplus::UnitPixel);
This pastes the png just how it's supposed to. I edit the png with GIMP. My function now draws the png stretched. I edit it with mspaint doing the exact same changes. The png is drawn fine.
How does this happen?

Related

How can i crop a specific area of image using python

I wanted to crop a specific area of images, the images uploaded are of different dimensions but all have these areas so i want a python script that can crop actually that part and make a new image.
I am uploading the original pics too and the pics after cropping too, the output I want to achieve actually.
First original image
First cropped image
Sceond Original Image
Second cropped Image

PNG file looks completely different inside of Unity

I purchased the "Set Builder: Back street Manhattan" with came with some png textures such as this one.
When I open the file in the browser or any editing program, it looks completely transparent except for the windows. When I drag the image into Unity, it is completely opaque bricks (which is what I want) If I duplicate the image and drag that image into Unity, it is again completely opaque bricks. If I save a copy of the image with photoshop or another application, the information that contained the bricks is lost and it is now mostly transparent, except it has some blotchy white textures which also aren't seen in the photoshop interpretation. Every texture in this folder is doing this same behavior. Are these files corrupted or compressed? How do I retain the brick information into an image editing program besides taking a screenshot within Unity ? Here is an example : of dragging images onto cubes in Unity. Left is a Photoshop copy. Right is attached image
The developer has not replied to my direct questions.
it can be your texture import format
try changing its format to true color
I found a solution in Photoshop.
Layer>layer mask>from transparency. Then right click on the layer to disable the transparency.

upload and preview as repeated background image

I am searching for a tool on web but didnt got any success their at all. I want to have something like upload and preview the image as background as repeated one or any other alternative...
I have this sample:
How can I preview and cut the image as a perfect background image as repeated one. Is it possible in Photoshop or in some similiar products?
The trick i have recovered is crop a part of the image in a big canvas of Photoshop and then making the deuplicate copies of the layers...
If the image seems like irregular it means the cropped image is wrong so you have to change with a other or larger part of the image...
If it is regular and doesn't cut at the side onto the edge, it means image is perfect making background repeated...
Thanks...

Grabbing image of UIScrollView content - anti-aliasing problem

I need to grab the scaled image of content currently visible in UIScrollView. I'm able to get the image but there is discrepancy between anti-aliasing algorithm used by scroll view and the grabbing process. Please look at the image to get my point:
(left: as seen in UIScrollView, right: as grabbed with renderInContext)
the image
I already tried to set interpolation quality, edge antialiasing mask and allow/force anti-alias in context using CGContextSetAllowsAntialiasing and CGContextSetShouldAntialias without success. The image is saved to file as an PNG with UIImagePNGRepresentation.
Any ideas how to grab the exact copy of what is visible in scroll view?

Why does UIImageView "darken"/saturate PNG images, and can I stop it?

I have a PNG file in a UIImageView, and next to that I have an EAGLView which displays the continuation of that same image (long story) as a texture, carved from the same original PNG. The point is, that these images, which should match up flawlessly, actually have somewhat differing color saturation.
Normally I'd blame my handling of the PNG texture load in GL, but when I hold Preview (with the PNG) up to the iPhone simulator, it's GL that's spot on, and the UIImageView that's wrong! It's taken the image and made it ever-so-slightly more saturated. The image view is opaque with 100% alpha.
I verified this on a clean UIImageView with another PNG file when put next to Preview.
Anyone know what's up?
If you are using Photoshop to save the png using the "Save for Web & Devices" tool, ensure the "Convert to sRGB" option is off and "Embed Color Profile" is also off. If you are using another editor, look for similar settings.
Read this, it will help explain better than I can.