I need a function to create a bitmap in memory with x,y size. On the hDC from this bitmap i will paint with a existing function for the Screen. And then i will convert this Bitmap to JPG. Is possible?
Thanks
Create a bitmap
Re: Create a bitmap
Günther,
I think, You want to resize with a zoom-factor, to keep the aspect ratio of the image ?
Next, this resized image ( BMP ) must be painted on a defined Window-background and saved as JPG ?
I created a complete sample, how it works.
![Image](http://www.pflegeplus.com/pictures/Iconvert1.jpg)
Maybe possible to add => FreeImage_Rescale ?
I used NCONVERT for the moment.
FreeImage_Rescale(FIBITMAP *dib, int dst_width, int, dst_height, FREE_IMAGE_FILTER filter)
DLL32 FUNCTION IMGRESCALE( ........
This function performs resampling (or scaling, zooming) of a greyscale or RGB(A) image to
the desired destination width and height. A NULL value is returned when the bitdepth cannot
be handled or when there’s not enough memory (this may happen with very large images).
16-bit RGB bitmap are returned as 24-bit. Palettized and 4-bit bitmap are returned as 8-bit
palettized images, using an internal conversion to 24-bit followed by a color quantization, or
are returned as 32-bit if they contain transparency.
Resampling refers to changing the pixel dimensions (and therefore display size) of an image.
When you downsample (or decrease the number of pixels), information is deleted from the
image. When you upsample (or increase the number of pixels), new pixels are added based
on color values of existing pixels. You specify an interpolation filter to determine how pixels
are added or deleted.
The following filters can be used as resampling filters:
Filter flag Description
FILTER_BOX Box, pulse, Fourier window, 1st order (constant) B-Spline
FILTER_BILINEAR Bilinear filter
FILTER_BSPLINE 4th order (cubic) B-Spline
FILTER_BICUBIC Mitchell and Netravali's two-param cubic filter
FILTER_CATMULLROM Catmull-Rom spline, Overhauser spline
FILTER_LANCZOS3 Lanczos-windowed sinc filter
Best regards
Uwe![Question :?:](./images/smilies/icon_question.gif)
I think, You want to resize with a zoom-factor, to keep the aspect ratio of the image ?
Next, this resized image ( BMP ) must be painted on a defined Window-background and saved as JPG ?
I created a complete sample, how it works.
![Image](http://www.pflegeplus.com/pictures/Iconvert1.jpg)
Maybe possible to add => FreeImage_Rescale ?
I used NCONVERT for the moment.
FreeImage_Rescale(FIBITMAP *dib, int dst_width, int, dst_height, FREE_IMAGE_FILTER filter)
DLL32 FUNCTION IMGRESCALE( ........
This function performs resampling (or scaling, zooming) of a greyscale or RGB(A) image to
the desired destination width and height. A NULL value is returned when the bitdepth cannot
be handled or when there’s not enough memory (this may happen with very large images).
16-bit RGB bitmap are returned as 24-bit. Palettized and 4-bit bitmap are returned as 8-bit
palettized images, using an internal conversion to 24-bit followed by a color quantization, or
are returned as 32-bit if they contain transparency.
Resampling refers to changing the pixel dimensions (and therefore display size) of an image.
When you downsample (or decrease the number of pixels), information is deleted from the
image. When you upsample (or increase the number of pixels), new pixels are added based
on color values of existing pixels. You specify an interpolation filter to determine how pixels
are added or deleted.
The following filters can be used as resampling filters:
Filter flag Description
FILTER_BOX Box, pulse, Fourier window, 1st order (constant) B-Spline
FILTER_BILINEAR Bilinear filter
FILTER_BSPLINE 4th order (cubic) B-Spline
FILTER_BICUBIC Mitchell and Netravali's two-param cubic filter
FILTER_CATMULLROM Catmull-Rom spline, Overhauser spline
FILTER_LANCZOS3 Lanczos-windowed sinc filter
Best regards
Uwe
![Question :?:](./images/smilies/icon_question.gif)
Last edited by ukoenig on Sun Nov 10, 2013 1:19 pm, edited 6 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
Re: Create a bitmap
Günther,
Please look for CreateCompatibleDC and CreateCompatibleBitmap in FWH sources, you will find several code examples
Please look for CreateCompatibleDC and CreateCompatibleBitmap in FWH sources, you will find several code examples
Re: Create a bitmap
Thanks Antonio and Uwe!
I will look at that. But the "best" version in my case is to make a hidden dialog, paint with the old outine on it (then no changes are required) and make a screenshoot.
I will look at that. But the "best" version in my case is to make a hidden dialog, paint with the old outine on it (then no changes are required) and make a screenshoot.
Re: Create a bitmap
Günther,
I don't know, if it will be still useful for You or any other user.
I finished my allinone-solution, with possible
RESIZE and CONVERT the original size or resized to any other format.
( because ALPHA-images are supported for DISPLAY and EXPORT it can be used as a LOGO-editor )
WINDOW- or DIALOG-display in DESIGN-mode
EXPORT all settings / selections to a extra EXE-file.
Painters for WINDOW- and DIALOG-background ( showing any combination )
Painter, to resize and define the EXPORT-format of a image.
there are two solutions :
Window-display
( shows the original, resized or converted )
The sample shows the RESIZED original
![Image](http://www.pflegeplus.com/pictures/Imgconv1.jpg)
Optional NEW Dialog-display
( shows the original, resized or converted )
The sample shows the RESIZED original
![Image](http://www.pflegeplus.com/pictures/Imgconv2.jpg)
The sample shows a resized TRANSPARENT logo
![Image](http://www.pflegeplus.com/pictures/Imgconv3.jpg)
define Image-size, position and export-format
![Image](http://www.pflegeplus.com/pictures/Imgconv4.jpg)
Result of a created external PRG- and EXE-file ( everything is defined inside the Main-tool )
![Image](http://www.pflegeplus.com/pictures/Imgconv5.jpg)
Best Regards
Uwe![Question :?:](./images/smilies/icon_question.gif)
I don't know, if it will be still useful for You or any other user.
I finished my allinone-solution, with possible
RESIZE and CONVERT the original size or resized to any other format.
( because ALPHA-images are supported for DISPLAY and EXPORT it can be used as a LOGO-editor )
WINDOW- or DIALOG-display in DESIGN-mode
EXPORT all settings / selections to a extra EXE-file.
Painters for WINDOW- and DIALOG-background ( showing any combination )
Painter, to resize and define the EXPORT-format of a image.
there are two solutions :
Window-display
( shows the original, resized or converted )
The sample shows the RESIZED original
![Image](http://www.pflegeplus.com/pictures/Imgconv1.jpg)
Optional NEW Dialog-display
( shows the original, resized or converted )
The sample shows the RESIZED original
![Image](http://www.pflegeplus.com/pictures/Imgconv2.jpg)
The sample shows a resized TRANSPARENT logo
![Image](http://www.pflegeplus.com/pictures/Imgconv3.jpg)
define Image-size, position and export-format
![Image](http://www.pflegeplus.com/pictures/Imgconv4.jpg)
Result of a created external PRG- and EXE-file ( everything is defined inside the Main-tool )
![Image](http://www.pflegeplus.com/pictures/Imgconv5.jpg)
Best Regards
Uwe
![Question :?:](./images/smilies/icon_question.gif)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.