I apologize if this is the wrong forum to post this question. I am
not
sure which would be the best forum to post this question. Please
advise me if this is not the right forum.
Now my question. I have an Image being copied over to Clipboard using
Windows SetClipBoardData(UINT nFormat, HANDLE hMem) call.
The original Image has a resolution of 300 DPI. But, the Image being
copied over to the Clipboard has 86 DPI only. Incidentally, this
matches my monitor screen resolution as well.
I am saving the Image as a BITMAP ( by passing in CF_BITMAP as the
"nFormat" parameter value to the above SetClipBoardData() call. When
I
set the "nFormat" as CF_TIFF instead of CF_BITMAP, Clipboard gives an
error that the format is in binary and it cannot copy the file. The
exact error when CF_TIFF used is:
"The information is in a binary format. Clipbook viewer cannot
display
this format. To view the information, try pasting it into a
document."
Can anyone please let me know how I would be able to keep the image
resolution when copying over to the clipboard?
Or am I doing anything wrong?
Thanks in advance
The first thing I'd do is try pasing into some different applications. You
gave very little description of how you determined the resolution was
reduced. What application did you paste it to??? Try pasting it to some
higher-end graphics application and see if the same thing happens. If you
can confirm that what is in the clipboard is really not the expected
resolution, then you need to look more closely at what you are storing
there.
The clipboard won't be modifying the resolution of an image stored there.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"curious" <raja...@gmail.com> wrote in message
news:67898333-8b1d-4e75...@59g2000hsb.googlegroups.com...
Hi Jonathan,
Thanks for the reply. I do all this programmatically using a 3rd party
software ofcourse to generate the BITMAP to be copied over to
clipboard. Of course when I save the same BITMAP to a file as a TIFF,
the resolution is not lost. But when I save it to the Clipboard, and
then when I paste it to viewers, I get a reduced resolution.
I tried a couple of viewers. The first one I tried is the Microsoft
Document Imaging - when I paste the bitmap into this application, I
see that the resolution is reduced. I then right click on it and check
the page properties which shows me the Resolution to be 86 DPI
( matching my monitor's resolution )
I then tried IrfanView as well. IrfanView application also shows us
the properties of the image but for those images that have been pasted
from the clipboard the resolution textboxes are blank. But, looking at
the image, I can clearly say that the resolution has been reduced.
Can you pleas suggest any other applications that I can test this
issue with?
Thanks in advance
How about Clipboard Viewer (Clipbrd.exe) that comes with Windows?
-- David
Anyway, copying a bitmap to the clipboard is a very simple task that you
don't need a 3rd party lib for.
http://www.codeguru.com/cpp/g-m/bitmap/article.php/c1715/
Any many more example on the net.
AliR.
"David Ching" <d...@remove-this.dcsoft.com> wrote in message
news:Iuwzk.355$be....@nlpi061.nbdc.sbc.com...
Hi David,
I have been toying with the Clipbrd.exe right from the beginning. I
can definitely see that the resolution has been already reduced.
Unfortunately Clipbrd.exe doesnt have a way to view the page
properties like other viewers do.
Thanks
Hi AliR,
That's a possiblity. But as I had explained in my post, when I use
this same Bitmap to create a TIFF file, I didnt see the reduction in
resolution. The new file was created with exactly the same resolution
as the old one.
THanks
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Hi Joe,
Thanks for the reply. I have a question though. Resolution is nothing
but the number of pixels( or dots ) per inch, right?
So, if I have a bitmap of say 540Pi X 360 Pi and if it fits in a 6"X4"
frame why can't I say that it's resolution is 90PPI? Pardon my
ignorance but shouldnt any image ( wheter it's a TIFF or BITMAP or
something else ) have resolution? It's just some metadata on the
image, isnt it?
THanks
Joseph M. Newcomer schrieb:
> Note that there is no intrinsic dpi property of bitmap files.
Until now I was sure that the biXPelsPerMeter and biYPelsPerMeter fields of the
BITMAPINFOHEADER (which is part of the BMP file) contain the image's resolution.
If my calculation is correct a 72 dpi bitmap would have these fileds set to
someting like 2835. Am I wrong or missing something?
Norbert
***
If you display it as 6x4, then you have a 90dpi image. But if your display is a printer,
the printer might have 1200dpi resolution; if you display the bitmap 1:1 on a printer, you
end up with a 0.45inch * 0.30inch image. Resolution in dpi is a function of the display
device rendering the pixels (assuming you have one pixel of your image displayed as one
pixel on the display device). So NO image has "resolution" because resolution does not
EXIST until the image is displayed! Images *only* have pixels. Display devices only have
pixels. If you display your image on a Jumbotron (one of those huge devices in sports
stadiums), with one pixel per jumbotron pixel, you end up with a resolution down in the
small-single-digits-per-inch, such as 3dpi or 2dpi. But it's the same image. So you
cannot claim that resolution is an intrinsic part of an image.
By the way, my display has a resolution of 120dpi, so if I displayed your image 1:1 it
would still be 540x360, but it would be 4.5"x3", ***but it would still be the same
image***.
The metadata might suggest resolution in dpi, but if the display system does not support a
resolution which is exactly that, the pixels will be expanded or compressed to cause the
image to render in the desired size. If this results in 1.27 image pixels per display
pixel, or 1.27 display pixels per image pixel, the image is actually going to be distorted
from what the file contains (in some cases, rather unpleasantly, if you use simple
StretchBlt to do the rendering).
joe
****
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
On Wed, 17 Sep 2008 22:00:01 +0200, Norbert Unterberg <nunte...@newsgroups.nospam>
wrote: