I'm looking for the command and options to convert images (png, jpeg, whatever…) to 1bit/px bitmap image (similar to what happen when in photoshop when you convert it to bitmap). See example below
I'd like to do it programatically from within a rails app (e.g. RMagick or through ImageMagick)
The following works :
convert yo.jpg -remap pattern:gray30 mono.gif
but I' like to understand better what's happening, compared to what phosotsohp would do in that case; considering the many possibilities explained here (@roger_rowland thx for the link again)
In the end what I want to do is to have this "effect", and to enlarge the image without ending up with a blurry effect
Perhaps you just need to look at the ImageMagick documentation covering quantization and dithering, which I think is exactly what you're asking. Is it?
Ok - to make sure you don't get blurring when resizing, you will need to retain a copy of the original image (i.e. before half-toning or dithering or whatever). Then when you need to resize, do the resize (up or down, with suitable interpolator) on a copy of the original image, then repeat the monochrome conversion on this resized copy of the original to get your resized monochrome.
EDIT - following your latest comment, try something like this:
convert yo.jpg -colorspace Gray -ordered-dither h4x4a -scale 2000x2000 mono.png