Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

ReSamoling

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






Comments

  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    : 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]

  • gyanaroragyanarora Posts: 48Member
    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]
    :
    :

  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    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]

  • gyanaroragyanarora Posts: 48Member
    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]
    :
    :

  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    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]

  • gyanaroragyanarora Posts: 48Member
    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]
    :
    :

  • gyanaroragyanarora Posts: 48Member
    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]
    : :
    : :
    :
    :

Sign In or Register to comment.