Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Konrad B
Posts: 10 Joined: 2017-02-25T12:47:24-07:00
Authentication code: 1151
Post
by Konrad B » 2017-02-26T04:06:09-07:00
I found out, that the filter setting "-blur 0x1" dont works with IM 6.8.9-9
With this code:
Code: Select all
convert 20701-2757.bmp -colorspace gray -auto-level -threshold 50% -level 0x50% result.bmp
(without filter "-blur 0x1") the bmp file (result.bmp) was created - but the background was black.
http://bogx.de/media/result.bmp
I need background white and foreground black (= invert of the result above).
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2017-02-26T09:17:03-07:00
I think Konrad B wants a binary output, with black and white only. If so, then antiliasing isn't needed, so "-blur" isn't needed.
Konrad B wrote: I need background white and foreground black (= invert of the result above).
Then put "-negate" before the final output filename.
Konrad B
Posts: 10 Joined: 2017-02-25T12:47:24-07:00
Authentication code: 1151
Post
by Konrad B » 2017-02-26T09:24:11-07:00
Thanks guys!
I have the solution for PHP environment especially for my problem (to have always white background in 1-bit images) - is very simple:
Code: Select all
exec("convert input.png -monochrome -colors 2 result.bmp");
$color=exec('convert result.bmp -format "%[pixel: u.p{0,0}]" info:');
if ($color == 'black') {
exec("convert result.bmp -negate result.bmp");
}
Best regards,
Konrad
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2017-02-26T09:35:23-07:00
snibgo wrote: How do you define "background"?
You have decided that the pixel at (0,0) is always background. Fine.
Konrad B
Posts: 10 Joined: 2017-02-25T12:47:24-07:00
Authentication code: 1151
Post
by Konrad B » 2017-02-26T09:42:13-07:00
You have decided that the pixel at (0,0) is always background. Fine.
yes - exactly - all images have solid backgrounds in this project and are therefore very simple bitmaps
Best regards,
Konrad
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2017-03-06T16:13:12-07:00
Konrad B wrote: ↑ 2017-02-26T03:35:11-07:00
convert 20701-2756.bmp -colorspace gray -auto-level -threshold 50% -blur 0x1 -level 0x50% result_2.bmp
Result:
line 2 dont works - no file (result_2.bmp) is created
It works fine for me on IM 6.9.7.10 Q16 Mac OSX.
What do you mean by:
no file (result_2.bmp) is created