How to copy a portion of the screen and save it to a bitmap or PNG file in QB64? - bmp

I need to copy a specific portion of the screen and save it to a bitmap (BMP) or PNG file after drawing some stuff to that section of the screen. I'm having trouble understanding the new _PUTIMAGE vs GET and PUT. I'm not sure how to do this.

Related

Replace image(s) in PDF in swift. How to get image position in page?

I need to replace images in a PDFDocument or CGPDFDocument.
I found a way to extract images using the old Core Graphics API (i.e. not PDFKit). Here.
Now I would like to make a copy of a PDF but by replacing the existing images.
How can I get the width/height & coordinates of the existing images in the source PDF?
PDF are sooo complicated.
Thanks!

images get cropped in the generated presentation

i am using open xml sdk to copy slides into another presentation , when the slides are copied and my desired presentation is generated , I iterate through each slide of the generated document and replace its existing images with the image of my choice , the process is executing and the images gets replaced , but here is the bind , if the dimensions of my images are larger then the image in the document , the image gets cropped to fit to the size that was previously occupied by the replaced image .But if i do the whole process manually , by right clicking with my mouse , power point changes the dimension of the image its get shorter but its not cropped and the whole image is displayed ...
so what approach should i go for , do i have to change some xml settings through code , or do i have to change the dimension of my images using c# classes , what is the right approach to tackle this issue???
guys i will be anxiously waiting for your response ......
Better change the image before replacing the image in your target presentation file. As power point is going to embed your image in the file itself, you can reduce the size of the overall generated file if you compress the images to required dimensions before replacing.
Changing the dimensions in the xml is also a valid idea but you are embedding images into the file without any added advantage.
Some pointers on how to resize image in c# :
https://stackoverflow.com/a/87786/860243
http://www.peterprovost.org/blog/2003/05/29/Resize-Image-in-C/
http://dzone.com/snippets/c-resize-image-while

Rotating a PNG file

I have zero experience with manipulating image files of any sort with code, so I am lost about where to begin. All I need to do is open a PNG image file and save it rotated 90 degrees in objective-C. I am a quick learner, so even a push in the right direction would help immensely. I know this is no obscure function; any GUI image editor is capable of this, so I figure someone should be able to help. Thanks in advance!
(also, I have tagged this with iPhone to get more exposure; this is not something that needs to be iPhone-exclusive.)
Here's your "push":
Create a CGImage from the original file, using ImageIO (CGImageSourceCreateWithURL, CGImageSourceCreateImageAtIndex).
Create a bitmap context with transposed size, using Core Graphics (CGBitmapContextCreate).
Rotate the context's transformation matrix (CGContextConcatCTM)
Draw the original image into that context (CGContextDrawImage).
Create a new image from the bitmap context (CGBitmapContextCreateImage)
Save the image to a new file (CGImageDestinationCreateWithURL, CGImageDestinationAddImage, CGImageDestinationFinalize).
Have you tried looking at NSImage Rotation asked on Stackoverflow?

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

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?

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.