Bitmap ARGB1555 image format
Bitmap ARGB1555 image format
Hi,
I am new to imagemagick and started using ImageMagic++ api for the image operations. So far its a great product, but I need help from you guys.
I need to create a bmp image with ARGB1555 (16 bit), since I need to pass pixels as ARGB1555 to hardware(and its support only this format).
I could not able to figure out the API for that. I could see in change list where its telling support for ARGB1555 as image subtype. I could not able to figure any APIs doing the same. Please share your suggestions
I am new to imagemagick and started using ImageMagic++ api for the image operations. So far its a great product, but I need help from you guys.
I need to create a bmp image with ARGB1555 (16 bit), since I need to pass pixels as ARGB1555 to hardware(and its support only this format).
I could not able to figure out the API for that. I could see in change list where its telling support for ARGB1555 as image subtype. I could not able to figure any APIs doing the same. Please share your suggestions
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bitmap ARGB1555 image format
See https://imagemagick.org/script/command- ... php#define
bmp:subtype=RGB555|RGB565|ARGB4444|ARGB1555 BMP channel depth subtypes. Only support in BMP (BMP4). BMP3 and BMP2 do not contain header fields to support these options.
So in command line IM 7 Q16, it would be:
Sorry, I do not know how it would be specified in any API. The developers would need to provide that help.
_______________________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
bmp:subtype=RGB555|RGB565|ARGB4444|ARGB1555 BMP channel depth subtypes. Only support in BMP (BMP4). BMP3 and BMP2 do not contain header fields to support these options.
So in command line IM 7 Q16, it would be:
Code: Select all
magick image.suffix -define bmp:subtype=ARGB1555 -depth 16 result.bmp
_______________________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
Re: Bitmap ARGB1555 image format
Hi,
Thanks for your quick response.
I am using ImageMagick 7.0.7-31 and I am looking for the APIs, since I am using ImageMagick++.
Thanks for your quick response.
I am using ImageMagick 7.0.7-31 and I am looking for the APIs, since I am using ImageMagick++.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Bitmap ARGB1555 image format
A quick look at coders\bmp.c shows that IM uses GetImageOption to find that you want ARGB1555. So use SetImageOption in MagickCore or Magick++, or MagickSetOption in MagickWand.Coder wrote:... and I am looking for the APIs, since I am using ImageMagick++.
snibgo's IM pages: im.snibgo.com
Re: Bitmap ARGB1555 image format
Hi,
Thanks for your reply, I didnt see any API called SetImageOption in Magick++. I have seen another api callled "defineValue" where I can give magick option as "bmp" and key as "subtype" and value as "ARGB1555". Is it the right API? How can I get bmp pixels from Image object created???
Thanks for your reply, I didnt see any API called SetImageOption in Magick++. I have seen another api callled "defineValue" where I can give magick option as "bmp" and key as "subtype" and value as "ARGB1555". Is it the right API? How can I get bmp pixels from Image object created???
Re: Bitmap ARGB1555 image format
`defineValue` is indeed the correct API. And you probably want to use `getPixels` to get the pixels.
Re: Bitmap ARGB1555 image format
Thanks dlemstra by confirming API
But now I am wondering about the performance.
I wanted to scale the image every second or even less. I have tried using "resize" API and then used "scale" API which is even better. And then I have used sample API which makes the cpu usage even better. This will bring down the CPU usage by 5%. Is there any other way we can improve the CPU usage
But now I am wondering about the performance.
I wanted to scale the image every second or even less. I have tried using "resize" API and then used "scale" API which is even better. And then I have used sample API which makes the cpu usage even better. This will bring down the CPU usage by 5%. Is there any other way we can improve the CPU usage
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bitmap ARGB1555 image format
You can use the GPU via OpenCV is you have an appropriate graphics card. See
https://imagemagick.org/script/architec ... istributed
https://imagemagick.org/script/opencl.php
https://en.wikipedia.org/wiki/OpenCL
https://imagemagick.org/script/architec ... istributed
https://imagemagick.org/script/opencl.php
https://en.wikipedia.org/wiki/OpenCL
Re: Bitmap ARGB1555 image format
Right now we don't have an option for GPU . This is an embedded device we have the limitation over hardware resources. Only thing I am trying to achieve is optimize as much as possible. Since you guys are expert in imagemagick, please suggest some of the performance improvement tricks from imagemagick side.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Bitmap ARGB1555 image format
Sample is quicker than scale, which is quicker than resize. However, for ordinary photos, quicker is also lower quality.
If you have HDRI but don't need it, disabling HDRI will improve performance. Similarly reducing the Q number.
If you have OpenMP, removing it may reduce CPU usage but may also increase execution time
Are you simply doing read-resize-save, or something more complex? If more complex, there may be scope in rearranging the operations.
If you have HDRI but don't need it, disabling HDRI will improve performance. Similarly reducing the Q number.
If you have OpenMP, removing it may reduce CPU usage but may also increase execution time
Are you simply doing read-resize-save, or something more complex? If more complex, there may be scope in rearranging the operations.
snibgo's IM pages: im.snibgo.com
Re: Bitmap ARGB1555 image format
Interesting!
As you said, I have already done the below steps ( disabled HDRI, Q length is 8 bit) except disabling OpenMP.
Those steps improved performance a lot. I am not doing complex steps, doing text to bmp image conversion basically. But this is very frequent mostly less than a second. Is there any difference between label and annotate in terms of performance? Some how when I use "label " api I am not getting image with text, but annotate worked for me.
Steps which I am doing
Create an image with size ( size got from Font type metrics ) [ Typemtric also consumes CPU]
Annotate with the text - I can see CPU usage over this step
Set the magicktype as "BMP3" - ( I have tried to use define value api to convert the image to ARGB15555, but when i plotted pixel some how I am not getting proper display. Is getPixels is the raw pixels or its also contains bitmap info as well?
Resize image by using sample algm - Performance improved a lot after using sample algorithm
Write to blob and get the bitmap pixel from blob
The above actions are in a loop where loop interval is less than a second
As you said, I have already done the below steps ( disabled HDRI, Q length is 8 bit) except disabling OpenMP.
Those steps improved performance a lot. I am not doing complex steps, doing text to bmp image conversion basically. But this is very frequent mostly less than a second. Is there any difference between label and annotate in terms of performance? Some how when I use "label " api I am not getting image with text, but annotate worked for me.
Steps which I am doing
Create an image with size ( size got from Font type metrics ) [ Typemtric also consumes CPU]
Annotate with the text - I can see CPU usage over this step
Set the magicktype as "BMP3" - ( I have tried to use define value api to convert the image to ARGB15555, but when i plotted pixel some how I am not getting proper display. Is getPixels is the raw pixels or its also contains bitmap info as well?
Resize image by using sample algm - Performance improved a lot after using sample algorithm
Write to blob and get the bitmap pixel from blob
The above actions are in a loop where loop interval is less than a second
Re: Bitmap ARGB1555 image format
Any thoughts???
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bitmap ARGB1555 image format
-sample will downsize by skipping pixels and thus will be poor quality. If you can live with that, then it would be the faster of -resize, -scale and -sample.
Re: Bitmap ARGB1555 image format
Thanks for the comment! I am going keep the sample algorithm as as now for scaling.
Is there any difference between annotation and label in terms of performs? Or which is better API for text rendering?
Is there any difference between annotation and label in terms of performs? Or which is better API for text rendering?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bitmap ARGB1555 image format
I do not know which is more efficient. You would have to test that. But -annotate writes directly on the input image. With label:, you must create a new image with transparent background and then composite over the background image. So my guess is that -annotate would be faster. You can also test -draw. It works similar to -annnotate, but I like -annotate better as it is more flexible.