It is necessary to write a utility that will insert (x,y) text on the image. It is desirable that the utility does not depend on large libraries, since a minimum utility size is required. I'm looking for something similar in C/C++, I can't find anything. Maybe there is some simple library on D?
Thread overview | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 26, 2022 Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
April 26, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Zhirov | On Tuesday, 26 April 2022 at 17:22:54 UTC, Alexander Zhirov wrote: >It is necessary to write a utility that will insert (x,y) text on the image. It is desirable that the utility does not depend on large libraries, since a minimum utility size is required. I'm looking for something similar in C/C++, I can't find anything. Maybe there is some simple library on D? You can eventually use dplug:graphics for that |
April 26, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Zhirov | On Tue, Apr 26, 2022 at 05:22:54PM +0000, Alexander Zhirov via Digitalmars-d-learn wrote: > It is necessary to write a utility that will insert (x,y) text on the image. It is desirable that the utility does not depend on large libraries, since a minimum utility size is required. I'm looking for something similar in C/C++, I can't find anything. Maybe there is some simple library on D? Maybe use imagemagick? https://stackoverflow.com/questions/23236898/add-text-on-image-at-specific-point-using-imagemagick Handling multiple image formats is generally a complex task that requires multiple libraries, some of which may not be trivial. Unless you have a specific image format in mind? Also, text rendering, in general, is an extremely complex and hairy problem. At the very minimum, you need a font. If you have a bitmap font, then it's relatively easy (just blit the characters you need onto the image with alpha blending). But if you're looking at TTF fonts or similar, you're looking at the very minimum at using libfreetype to be able to meaningfully use the font file. Then there's the issue of font layout, which is language-specific and may require a complex layout engine like HarfBuzz (which requires libraries with complex dependencies). If utility size is of utmost importance, then the ideal case would be a fixed image format (so only 1 library is needed to process files of that type) with a bitmapped font (at worst, a 2nd library for reading the font) for a specific language (so no cross-language layout issues that requires complex layout engines). Then you can just treat the font characters as bitmaps and alpha-blend them onto the image. Preferably, use a monospaced bitmap font so that you can just use a fixed grid for character placement, and not have to deal with complex font metrics, hinting, kerning, and all of that complex stuff. For this, maybe look at Adam Ruppe's arsd library (https://github.com/adamdruppe/arsd) for some lightweight modules that read common image formats and do some primitive image manipulations. T -- People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird. -- D. Knuth |
April 26, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Tuesday, 26 April 2022 at 18:12:55 UTC, Guillaume Piolat wrote: >You can eventually use dplug:graphics for that
It's strange, for some reason it's not building. |
April 26, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Zhirov | On Tuesday, 26 April 2022 at 20:26:42 UTC, Alexander Zhirov wrote: >build error Curious as to what DMD you are using on what OS? It builds with 2.095.1 to 2.100-b1 here. |
April 26, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Tuesday, 26 April 2022 at 20:37:28 UTC, Guillaume Piolat wrote: >Curious as to what DMD you are using on what OS? It builds with 2.095.1 to 2.100-b1 here. DMD64 D Compiler v2.098.0 |
April 26, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Zhirov | On Tuesday, 26 April 2022 at 20:45:16 UTC, Alexander Zhirov wrote: >On Tuesday, 26 April 2022 at 20:37:28 UTC, Guillaume Piolat wrote: >Curious as to what DMD you are using on what OS? It builds with 2.095.1 to 2.100-b1 here. DMD64 D Compiler v2.098.0 Well I cannot reproduce your problem => https://imgur.com/a/HZvZWr2 Perhaps a DUB mismatch that would give different DIP flags. Good luck. |
April 27, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | To get the commands dub used, use -v. $ dub build -v |
April 26, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | On Tuesday, 26 April 2022 at 21:04:17 UTC, rikki cattermole wrote: >$ dub build -v
|
April 27, 2022 Re: Library for image editing and text insertion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Zhirov | No args added there. https://github.com/AuburnSounds/Dplug/blob/master/graphics/dplug/graphics/pngload.d#L1972 Yup that code certainly looks wrong. Note the casts above it in around: https://github.com/AuburnSounds/Dplug/blob/master/graphics/dplug/graphics/pngload.d#L1956 So yeah upstream issue. |