Re: BMP to JPG (again)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Cool, thank you!

Question:
---------
MSDN says about "SHLoadImageFile": [...]Converts a .gif file to a
bitmap.[...]
Now i know it also can load a BMP :-)

How did you know about this function(s) if you just knew, that you like to
load a BMP but didn' know if there's a MS-DLL available with some function
to do that?

And: my biggest problems with P/Invoke is, that i don't know which .Net
type/class is compatible to some C++ declaration/parameter in the
parameters. Is there something like a list or a documentation about this?

Boris

On Wed, 27 Apr 2005 12:37:17 +0300, Sergey Bogdanov wrote:

> I was using SHLoadImageFile [1] just for simplicity. It loads image file
> and returns its HBITMAP which I pass to WriteBitmapIntoJpegFile.
>
> To convert byte array with image into JPG file you have to use
> WriteRGBBytesIntoJpegFile P/Invoke. The last parameter is an array with
> length equals to height * width * 3 (where 3 bytes is RGB). I have
> updated JpegTest [2] now it also demonstrates how to use
> WriteRGBBytesIntoJpegFile function.
>
> [1]
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/apippc/html/ppc_aygshell_thcu.asp
> [2]
> http://www.sergeybogdanov.com/Samples/JpegTest.zip
>
> Best regards,
> Sergey Bogdanov
> http://www.sergeybogdanov.com
>
>
> Boris Nienke wrote:
>> Thanks a lot!
>> I will look deeper into it when i'm back home.
>>
>> Currently i wonder what "SHLoadImageFile" exactly is/does and if it's
>> possible to do convertion to JPG with an in-memory bitmap. I will see
>>
>> Boris
>>
>> On Tue, 26 Apr 2005 19:35:39 +0300, Sergey Bogdanov wrote:
>>
>>
>>>I have written wrapper for IJG and now you can convert BMP file into JPG
>>>file. How it could be done see this example:
>>>http://www.sergeybogdanov.com/Samples/JpegTest.zip
>>>
>>>Best regards,
>>>Sergey Bogdanov
>>>http://www.sergeybogdanov.com
>>>
>>>
>>>Boris Nienke wrote:
>>>
>>>>yes - that's what i find whenever i start a new search about this topic.
>>>>
>>>>But isn't there anyone who has done this allready?
>>>>A DLL or something with some wrapper-class to do this with C#?
>>>>
>>>>I'm not a C/C++ guru - so writing a "wrapper around IJG" is not that easy
>>>>for me.
>>>>
>>>>I'm still hoping that someone out there has done this successfully and like
>>>>to share <hope hope hope> :-)
>>>>
>>>>Boris
>>>>
>>>>On Mon, 25 Apr 2005 16:54:38 +0300, Sergey Bogdanov wrote:
>>>>
>>>>
>>>>
>>>>>See this article:
>>>>>http://www.pocketpcdn.com/articles/savejpeg.html
>>>>>
>>>>>You might try to write wrapper around IJG library and then using
>>>>>P/Invoke call required methods to convert BMP to JPEG.
>>>>>
>>>>>Best regards,
>>>>>Sergey Bogdanov
>>>>>http://www.sergeybogdanov.com
>>>>>
>>>>>
>>>>>Boris Nienke wrote:
>>>>>
>>>>>
>>>>>>On Fri, 22 Apr 2005 08:54:41 +0200, Boris Nienke wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi,
>>>>>>>
>>>>>>>is there a function available (C# wrapper or something) to convert BMP file
>>>>>>>to a JPG file?
>>>>>>>i think i ask this once a year at least ;-) but i'm still hoping :)
>>>>>>>
>>>>>>
>>>>>>
>>>>>>Really no solution yet available?
>>>>>>Hard to believe....
>>>>>>
>>>>>>Boris
.



Relevant Pages

  • Re: Two more questions: sounds and JPG.
    ... This will allow you to load a gif, png, jpg, bmp... ... the decoding codes which it should) ... How can I load from file an image different from bitmap (i.e. JPG)? ...
    (microsoft.public.windowsce.embedded.vc)
  • Getting the pixel color of an image at a particular coordinate...
    ... I have a requirement to load a Black & White ... image (could be either a JPG or a BMP) and find out the the color of certain ... pixels at certain fixed coodinates. ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Loading Image to MatLAB GUI
    ... In the GUI define axis, origin is at bottom left corner, but when I load a bmp or JPG to that axis, the origin of the Image is at Top left corner ...
    (comp.soft-sys.matlab)
  • Re: Loading Image to MatLAB GUI
    ... In the GUI define axis, origin is at bottom left corner, but when I load a bmp or JPG to that axis, the origin of the Image is at Top left corner ...
    (comp.soft-sys.matlab)
  • RE: stego and executable files
    ... Hiding executables in the JPEG implies that whatever you use to read the ... to demostrate on JPG and BMP picture formates, ... Now to the structure of BMP files. ... Now JPG has structure more suitable for storage, ...
    (Security-Basics)