Hi all I have a Bitmap image, I want to know its current Resolution and want to change it.Can Any one suggest how to do it or provide information about a standard Algorithm. Regards --gyan
: Hi all : I have a Bitmap image, I want to know its current Resolution and want to change it.Can Any one suggest how to do it or provide information about a standard Algorithm. : Regards : --gyan OK, are you in Windows, Linux, DOS, X-Win? If you're in Windows I can show you a built-in set of commands to stretch, shrink, flip, rotate, etc any bitmap data. Very simple too!
Thanks for a reply Iam in Windows and using Visual C++. Waiting for a reply. --Gyan : : Hi all : : I have a Bitmap image, I want to know its current Resolution and want to change it.Can Any one suggest how to do it or provide information about a standard Algorithm. : : Regards : : --gyan : OK, are you in Windows, Linux, DOS, X-Win? If you're in Windows I can show you a built-in set of commands to stretch, shrink, flip, rotate, etc any bitmap data. Very simple too! : : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic] : :
Hi I am sorry I didn't give you clear idea.Actually I have a function which opens bitmap files(.bmp) and do some processing.These bitmap files must be only of a specific resolution so I want this function to first check the resolution and if needed changes the resolution.
More clearly as I can change the resolution of my bitmap file using Windows Imaging (simply right click on the image opened, select properties menu and a dialog appears then select tab Resolution). I want to provide that type of functionality i.e. after going through my fucntion the Resolution is changed. --Gyan : OK, look these up in your compiler's help files. These are built-into Windoze, so you should have something on them. : : BitBlt : CreateBitmap : CreateBitmapIndirect : CreateCompatibleBitmap : CreateDIBitmap : CreateDIBSection : CreateDiscardableBitmap : ExtFloodFill : FloodFill : GetBitmapBits : GetBitmapDimensionEx : GetDIBColorTable : GetDIBits : GetPixel : GetStretchBltMode : LoadBitmap : MaskBlt : PatBlt : PlgBlt : SetBitmapBits : SetBitmapDimensionEx : SetDIBColorTable : SetDIBits : SetDIBitsToDevice : SetPixel : SetPixelV : SetStretchBltMode : StretchBlt : StretchDIBits : : Those were pasted right from my help file on Bitmaps. Hope these help ya', and if not, post again. : : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic] : :
OK for this project I would read in the header using fread() to check your resolution and then close the file. If the bitmap is the resolution you want, I'd use "LoadImage" or some home-brew function to load the bitmap into memory. Next I'd use "StretchBlt" to stretch the image to fit a window of the resolution you want your bitmap at. Finally, I'd take a snapshot of the bitmap in this window and write it to the new bitmap file. Sounds like a lot, but with the built-in functions you could do this real easy.
Hi friend Thanks for the technique you suggested.I tried your technique and stretched the image to my resolution I want But to write this stretched image in a file I need to access the pixel values which I tried to get using CDC::GetPixel(). The values I wrote to file provide a distorted image,Why is it happening I could not find. If I stretch the original image with factor 1 the whole technique work and the new file with stretched image is original image(not distorted), i.e. the technique is not working when I stretch actually. --Gyan
: OK for this project I would read in the header using fread() to check your resolution and then close the file. If the bitmap is the resolution you want, I'd use "LoadImage" or some home-brew function to load the bitmap into memory. Next I'd use "StretchBlt" to stretch the image to fit a window of the resolution you want your bitmap at. Finally, I'd take a snapshot of the bitmap in this window and write it to the new bitmap file. Sounds like a lot, but with the built-in functions you could do this real easy. : : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic] : :
Thanks a lot It is working now. Regards --Gyan : Hi friend : Thanks for the technique you suggested.I tried your technique and stretched the image to my resolution I want But to write this stretched image in a file I need to access the pixel values which I tried to get using CDC::GetPixel(). : The values I wrote to file provide a distorted image,Why is it happening I could not find. : If I stretch the original image with factor 1 the whole technique work and the new file with stretched image is original image(not distorted), i.e. the technique is not working when I stretch actually. : --Gyan : : : : OK for this project I would read in the header using fread() to check your resolution and then close the file. If the bitmap is the resolution you want, I'd use "LoadImage" or some home-brew function to load the bitmap into memory. Next I'd use "StretchBlt" to stretch the image to fit a window of the resolution you want your bitmap at. Finally, I'd take a snapshot of the bitmap in this window and write it to the new bitmap file. Sounds like a lot, but with the built-in functions you could do this real easy. : : : : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic] : : : : : :
Comments
: I have a Bitmap image, I want to know its current Resolution and want to change it.Can Any one suggest how to do it or provide information about a standard Algorithm.
: Regards
: --gyan
OK, are you in Windows, Linux, DOS, X-Win? If you're in Windows I can show you a built-in set of commands to stretch, shrink, flip, rotate, etc any bitmap data. Very simple too!
-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
Iam in Windows and using Visual C++.
Waiting for a reply.
--Gyan
: : Hi all
: : I have a Bitmap image, I want to know its current Resolution and want to change it.Can Any one suggest how to do it or provide information about a standard Algorithm.
: : Regards
: : --gyan
: OK, are you in Windows, Linux, DOS, X-Win? If you're in Windows I can show you a built-in set of commands to stretch, shrink, flip, rotate, etc any bitmap data. Very simple too!
:
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
:
:
BitBlt
CreateBitmap
CreateBitmapIndirect
CreateCompatibleBitmap
CreateDIBitmap
CreateDIBSection
CreateDiscardableBitmap
ExtFloodFill
FloodFill
GetBitmapBits
GetBitmapDimensionEx
GetDIBColorTable
GetDIBits
GetPixel
GetStretchBltMode
LoadBitmap
MaskBlt
PatBlt
PlgBlt
SetBitmapBits
SetBitmapDimensionEx
SetDIBColorTable
SetDIBits
SetDIBitsToDevice
SetPixel
SetPixelV
SetStretchBltMode
StretchBlt
StretchDIBits
Those were pasted right from my help file on Bitmaps. Hope these help ya', and if not, post again.
-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
I am sorry I didn't give you clear idea.Actually I have a function which opens bitmap files(.bmp) and do some processing.These bitmap files must be only of a specific resolution so I want this function to first check the resolution and if needed changes the resolution.
More clearly as I can change the resolution of my bitmap file using Windows Imaging (simply right click on the image opened, select properties menu and a dialog appears then select tab Resolution).
I want to provide that type of functionality i.e. after going through my fucntion the Resolution is changed.
--Gyan
: OK, look these up in your compiler's help files. These are built-into Windoze, so you should have something on them.
:
: BitBlt
: CreateBitmap
: CreateBitmapIndirect
: CreateCompatibleBitmap
: CreateDIBitmap
: CreateDIBSection
: CreateDiscardableBitmap
: ExtFloodFill
: FloodFill
: GetBitmapBits
: GetBitmapDimensionEx
: GetDIBColorTable
: GetDIBits
: GetPixel
: GetStretchBltMode
: LoadBitmap
: MaskBlt
: PatBlt
: PlgBlt
: SetBitmapBits
: SetBitmapDimensionEx
: SetDIBColorTable
: SetDIBits
: SetDIBitsToDevice
: SetPixel
: SetPixelV
: SetStretchBltMode
: StretchBlt
: StretchDIBits
:
: Those were pasted right from my help file on Bitmaps. Hope these help ya', and if not, post again.
:
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
:
:
-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
Thanks for the technique you suggested.I tried your technique and stretched the image to my resolution I want But to write this stretched image in a file I need to access the pixel values which I tried to get using CDC::GetPixel().
The values I wrote to file provide a distorted image,Why is it happening I could not find.
If I stretch the original image with factor 1 the whole technique work and the new file with stretched image is original image(not distorted), i.e. the technique is not working when I stretch actually.
--Gyan
: OK for this project I would read in the header using fread() to check your resolution and then close the file. If the bitmap is the resolution you want, I'd use "LoadImage" or some home-brew function to load the bitmap into memory. Next I'd use "StretchBlt" to stretch the image to fit a window of the resolution you want your bitmap at. Finally, I'd take a snapshot of the bitmap in this window and write it to the new bitmap file. Sounds like a lot, but with the built-in functions you could do this real easy.
:
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
:
:
Regards
--Gyan
: Hi friend
: Thanks for the technique you suggested.I tried your technique and stretched the image to my resolution I want But to write this stretched image in a file I need to access the pixel values which I tried to get using CDC::GetPixel().
: The values I wrote to file provide a distorted image,Why is it happening I could not find.
: If I stretch the original image with factor 1 the whole technique work and the new file with stretched image is original image(not distorted), i.e. the technique is not working when I stretch actually.
: --Gyan
:
:
: : OK for this project I would read in the header using fread() to check your resolution and then close the file. If the bitmap is the resolution you want, I'd use "LoadImage" or some home-brew function to load the bitmap into memory. Next I'd use "StretchBlt" to stretch the image to fit a window of the resolution you want your bitmap at. Finally, I'd take a snapshot of the bitmap in this window and write it to the new bitmap file. Sounds like a lot, but with the built-in functions you could do this real easy.
: :
: : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
: :
: :
:
: