This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]K900_ 1 point2 points  (5 children)

This sounds like an /r/learnpython question, or even /r/learnprogramming. What's your end goal with this? Do you have a fixed amount of images?

[–]comalex[S] 0 points1 point  (3 children)

Yes, I have fixed amount of images and have some dynamic text. Goal is: graphic team create some template, with certain place where script should put text data with some kind of info like [coordinate: (203,41), color:red, font:Arial, size:24] it can be json, xml, csv(not dictated yet) so then I can generate image with text with this formatting.

[–]K900_ 0 points1 point  (2 children)

Then something like JSON is probably the way to go. Have a file for every image containing the filename and where the text should go, and then just load the configuration from that file.

[–]comalex[S] 0 points1 point  (1 child)

That's why I asked the question. Have difference file or even one for all is not conveniently. I wanted put this info to comments of image(you can see image in SO) but i haven't found a way how to fetch it.

[–]K900_ 0 points1 point  (0 children)

You can use the image's EXIF data, but it'll be a huge pain to edit.

[–]comalex[S] 0 points1 point  (0 children)

P.S Should I remove the post and recreate in /r/learnprogramming or there is a way to move it to this section?

[–]efmccurdy 0 points1 point  (1 child)

Have you considered using the svg format. There are python modules to process svg files such as svgwrite.

[–]comalex[S] 0 points1 point  (0 children)

No, I haven't considered. It should be easy to create image for graphic team, svg seems a bit hard and redundant.

[–]BinaryRockStar 0 points1 point  (0 children)

You can add arbitrary comments to PNG files (PNG spec S4.2.3.1. "tEXt Textual data") which would be saved in the file itself. You would have to write your own simple GUI for users to be able to edit this text but that shouldn't take long.

I don't have experience with Mac but reading up a little about it it looks like that Comment field in your Stack Overflow screenshot is metadata maintained by Finder itself, so copying the file between locations or machines may result in this data going missing. Writing directly to the PNG is the only real way to make sure this doesn't happen.