Good time,
I work with E-inc displays and I need to load BMP images with 4-bit depth. Images saved using MS Paint in the BMP with 16 colours are displayed correctly.
Converting with ImageMagick does not match with Paint and is displayed on the screen is very faded. I'm trying to make the conversion as same as possible to MS Paint version.
For example, I tried the following commands:
convert input -type Palette + dither -colors 16 -depth 4 BMP3:output.bmp
convert input -type Grayscale -white-threshold 3000% +dither -colors 16 -depth 4 BMP3: output.bmp
Paint, before converting, does some kind of conversion over pixels - it's unclear what.
https://ibb.co/2ZpcMFs - via Paint
https://ibb.co/5hvWL4b - via ImageMagick
Converting any image to 16 colour BMP (4 bits depth) as in MS Paint
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting any image to 16 colour BMP (4 bits depth) as in MS Paint
What version of IM? On what platform?
Please link to your input image.
Remove the space after "+" in "+ dither".
I'm not sure what result you want, but this gives an image with no more than 16 colours, using a palette with 4-bit index. However, each palette entry has 8 bits per channel per pixel.
Please link to your input image.
Remove the space after "+" in "+ dither".
I'm not sure what result you want, but this gives an image with no more than 16 colours, using a palette with 4-bit index. However, each palette entry has 8 bits per channel per pixel.
Code: Select all
convert toes.png -colors 16 BMP3:toes-16-b.bmp
snibgo's IM pages: im.snibgo.com
Re: Converting any image to 16 colour BMP (4 bits depth) as in MS Paint
I use ImageMagick-7.0.8-34-Q16-x64-dll.exe on Windows 10
Let me try to explain on another example.
Link on origin image - https://ibb.co/TkHLTyN (resolution is 240x400 px)
When I save the original image in MS Paint to 16-colour BMP, I get a file with size 48 118 bytes (header - 118 bytes)
- link on part of hex: https://ibb.co/Bn1sb2
Then, I try to convert the original image:
And get a file with size 288 054 bytes (24-bits depth):
- link on part of hex: https://ibb.co/JjWBgZr
Then, I try next command:
Get a file with normal size - 48 118 bytes. Hex - https://ibb.co/GWJhRrw
The difference between the MS Paint and last image command:it's 0xff for first and 0x77 for the second. For this reason, when displaying the second image on the e-ink display, I get a gray picture, instead of a black and white. How to convert an image through ImageMagick to get an image, as if I had converted through Paint?
Note: direct link on original file - https://drive.google.com/open?id=1I5Xft ... Bu5yEBMb6J
Let me try to explain on another example.
Link on origin image - https://ibb.co/TkHLTyN (resolution is 240x400 px)
When I save the original image in MS Paint to 16-colour BMP, I get a file with size 48 118 bytes (header - 118 bytes)
- link on part of hex: https://ibb.co/Bn1sb2
Then, I try to convert the original image:
Code: Select all
convert text_origin.png +dither -colors 16 BMP3:text_magic.bmp
- link on part of hex: https://ibb.co/JjWBgZr
Then, I try next command:
Code: Select all
convert text_origin.png -type Grayscale -white-threshold 3000% +dither -colors 16 -depth 4 BMP3:240x400.bmp
The difference between the MS Paint and last image command:it's 0xff for first and 0x77 for the second. For this reason, when displaying the second image on the e-ink display, I get a gray picture, instead of a black and white. How to convert an image through ImageMagick to get an image, as if I had converted through Paint?
Note: direct link on original file - https://drive.google.com/open?id=1I5Xft ... Bu5yEBMb6J
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting any image to 16 colour BMP (4 bits depth) as in MS Paint
https://imgbb.com/Bn1sb2 gives "That page doesn't exist", so I can't examine your output from MS Paint.
For v7, I suggest you use "magick", not "convert".
This gives a file of 48118 bytes, with 16 colours in a palette. Is that what you want?
"-white-threshold 3000%" . See http://www.imagemagick.org/script/comma ... -threshold . Your input has no pixels above 3000%, so this option should do nothing. What do you want it to do?
For v7, I suggest you use "magick", not "convert".
Code: Select all
magick text-origin.png +dither -colors 16 -type palette BMP3:t.bmp
"-white-threshold 3000%" . See http://www.imagemagick.org/script/comma ... -threshold . Your input has no pixels above 3000%, so this option should do nothing. What do you want it to do?
I don't understand. First what? Second what? What is 0xff?kowapuk wrote:The difference between the MS Paint and last image command:it's 0xff for first and 0x77 for the second.
snibgo's IM pages: im.snibgo.com
Re: Converting any image to 16 colour BMP (4 bits depth) as in MS Paint
I'll check it tomorrow. I look in hex file - seems right.snibgo wrote: ↑2019-03-18T07:48:49-07:00 For v7, I suggest you use "magick", not "convert".This gives a file of 48118 bytes, with 16 colours in a palette. Is that what you want?Code: Select all
magick text-origin.png +dither -colors 16 -type palette BMP3:t.bmp
Sorry for my English
Looks on my drive - https://drive.google.com/open?id=1dzqA3 ... ttJJPzXsRI
text_paint.bmp - i have converted it via Paint. In text_paintbmp_hex.PNG shows the hex code of the image.
Same actions I did via ImageMagick: text_convert.bmp and text_convert_bmp_hex.PNG (hex).
And text_magick_bmp_hex.PNG - it's hex file after
Code: Select all
magick text-origin.png +dither -colors 16 -type palette BMP3:t.bmp
Re: Converting any image to 16 colour BMP (4 bits depth) as in MS Paint
I can't convert as needed.snibgo wrote: ↑2019-03-18T07:48:49-07:00This gives a file of 48118 bytes, with 16 colours in a palette. Is that what you want?Code: Select all
magick text-origin.png +dither -colors 16 -type palette BMP3:t.bmp
I have two files in jpg: One and Two.
I want to convert them with the same quality and get the following results (see hex, color depth 4 bits, BMP): One_t and Two_t
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting any image to 16 colour BMP (4 bits depth) as in MS Paint
If One_t.bmp contains certain colours. If you want to reduce One.jpg to exactly those colours, and no more, then use "-remap" like this:
Those colours are a poor selection to represent the image. IM options "-colors" and "posterize" will not select those colours.
Code: Select all
magick One.jpg +dither -remap One_t.bmp out.png
snibgo's IM pages: im.snibgo.com