Requested feature from work. I think adding this lets somebody get rid of some 
other tool.

IBA::render_text() is a very basic "render text into the image pixels" 
functionality, exposed on the command line as oiiotool --text.  You can fully 
trick it out with optional arguments like:

    oiiotool --create 640x480 3 --text:x=20:y=400:size=24:font="Ariel 
Narrow.ttf" "Hello, world. This is my text." -o out.exr

Functionality is very limited -- all you have control over is font name, size, 
position, color, and the text.  There's no formatting or wrapping, and text 
that ends up off the edge of the image just disappears.  But this set of 
functionality is still really handy if you're just trying to slap a quick 
annotation on an image from the command line.

I used Freetype for the font rendering.  It's found automatically at build 
time, and if it's not present the render_text function just does nothing.

Currentlyt, if you want anything but the default font, you generally need to 
give a full pathname to the font file.  It tries to be clever in that if you 
only give the filename but not the full path (like I did above), it checks a 
default directory for it.  But it's not like it really does any kind of 
comprehensive search.  We may want to beef that up, but I figured that this was 
good enough for an initial code review and seek some feedback.


You can merge this Pull Request by running:

  git pull https://github.com/lgritz/oiio lg-text

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenImageIO/oiio/pull/392

-- Commit Summary --

* Basic text rendering into imges with ImageBufAlgo::render_text and oiitool 
--text

-- File Changes --

M src/CMakeLists.txt (1)
M src/cmake/externalpackages.cmake (22)
M src/doc/oiiotool.tex (81)
M src/include/imagebufalgo.h (14)
M src/libOpenImageIO/CMakeLists.txt (6)
M src/libOpenImageIO/imagebufalgo.cpp (116)
M src/oiiotool/oiiotool.cpp (74)

-- Patch Links --

  https://github.com/OpenImageIO/oiio/pull/392.patch
  https://github.com/OpenImageIO/oiio/pull/392.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenImageIO/oiio/pull/392
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to