Convert string automatically to inline image - adobe-indesign

I'm using InDesign's data merge to generate playing cards for my game. Is it possible to convert a specific string to an inline image?
"You may roll :red_die: and add the rolled valued to this card's value"
For example the :red_die: in the text above would be automatically converted to an inline icon of a red coloured die.

No you can't this way. But you can place images with datamerge to the condition some fields of your source is set as an image one meaning having a "#" prefix. InDesign will process fields like #image as an image to place. It's up to you to add such a field in your source. However you can't nest it within another datamerge tag so it may not work eventually.
Other solution is using F/C dialog to replace :red_die: with clipboard content (your image) or to use scripting. You may also consider variable content plugin like EasyCatalog.

Related

How to replace text in Gimp image programatically

As in the title - imagine there is some Gimp .xcf file containing many layers. Part of these layers contain text. Is there any format I can export .xcf file to, that it somehow preserve 'human readable' text ?
The final goal is to process that text and put it again into the file, I am aware that this sounds unusual but maybe some of you have an idea how to achieve scenario like that.
I did some research and I saw I can export image to .psd format and then using NPM package process that image and extract text. This is just partially solves the problem, because I will not know how to put the processed text back into this .psd file (unless I decompile this NPM package and try to write some implementation myself...)
Any solutions and alternatives higly appreciated
You can script Gimp (using Scheme or Python). Technically you cannot change the text in a layer (there is no API for that), but you can recover the characteristics of a text layer (original text, font type, font size...) and recreate a new layer with a new text. Here is some Python code to recover the text information:
def text_info(img,layer):
parasites=None
try:
parasites=layer.parasite_list()
except Exception as e:
pass;
if parasites and 'gimp-text-layer' in parasites:
data=layer.parasite_find('gimp-text-layer').data
pdb.gimp_message('Text layer "%s": %s' % (layer.name,data))
else:
pdb.gimp_message('No text information found for layer "%s"' % layer.name)
(this information is only present of the file has been saved, it is not available on a newly created layer, but this shouldn't bea problem in your case)
Of course if the text is in a plain bitmap layer of its own this cannot be done, you have to guess the font type & size (but sometimes the code above can still recover the text information)
But if your XCF has a simple structure, it can be a lot simpler to decompose it into individual images, and build a new image with ImageMagick, using some of these layers plus new text images (or directly rendered text).

use ghost script to extract single spot color

I am trying to use ghostscript to extract the image for a single spot color (from a PDF), REGARDLESS of whether it would be visible when printed.
I tried using the tiffsep device, but the problem is that any of the spot color that is hidden by objects above does not get sent out.
Is there any device, or settings that would allow simply any objects regardless of visibility to be extracted to a bitmap file.
If an object overlies another in PostScript then it is absolutely correct that it causes the underlying object not to render in that position (modulo overprint) because PostScript has an opaque imaging model.
So no, you can't prevent this, its supposed to work like that.

macOS using html tags in nstextfield

Im wondering is there any ways to make this possible:
I have a nstextfield(or nstextview). And I also have one button, clicking on that should activate Bold mode for selected text, or the text that would written further.
First idea I had - is to use attributes for characters that would be written further, but this idea is not so good, as I would need to save that string in file later. I can save attributed string, but this gives me not proper format, what I would like to see is kind of or smth like that.
If I understand correctly your "First idea" is correct. Within your program you use NSAttributedString to add bold etc. your text. When you wish to save the text you can convert to HTML, or a number of other formats, and reading these formats and converting back to NSAttributed is also supported. A good place to start is Formatted Documents and Attributed Strings.

Implementing Emoticon in windows store chat

I am developing a Windows Store chat app.
In this apps, I am using a TextBox to receive message content from the user. I want to implement Emoticons (Smileys) such that typing a code gives a respective image inline with the text.
For example, for :), I want to have a 'smile' image.
What you'll need to do is use a RichTextBlock to display your text. This will give you access to a adding in an InlineUIContainer block where necessary.
So, your process will be:
Accept text in a regular text box
Parse the text into a series of Inlines (Run, InlineUIContainer, etc)
Create a new Paragraph for the message
Add the Inliness to the Paragraph.
Add the Paragraph to your RichTextBlock's Blocks property (a BlockCollection).
For each piece of text:
Split the text, likely using Regex, searching for the keys which trigger an Image (':)', '(heart)', etc).
For each non-image text, create a Run with the Text set to the text of the split
For each Image, create an InlineUIContainer and an Image. Set the Image source to the proper Image path, then set the Child of the InlineUIContainer to the Image.
Add the Run or InlineUIContainer the Paragraph via Paragraph.Blocks.Add(Inline).
Certain icons may be included in the Segoe UI Symbol Font Family. If this is the case, you may choose to not use an Image for that symbol, and instead use a Run with the FontFamily set to Segoe UI Symbol. You can play around with the FontSize if you want them to be more prominent.
Hope this helps and happy coding!

Word VBA checkboxes with link to image that needs to be built up

I am having problems with a table containing checkboxes in Word.
I am working with a table containing 10 checkboxes. Next to this table, there is an image.
When the user checks one of the checkboxes, something has to be added to the image, i.e. the image is further completed.
However, the order of checking the checkboxes is not fixed or defined, so there are lots of different combinations.
Is there a way to add the additional parts to the original image, linked to the checkboxes? Or is this way too advanced for Word?
Word doesn't have this type of built-in functionality with images. There are too many state combinations for the checkboxes to make an image for each state in advance. One possibility could be to find a dll or ocx and draw the image programatically (advanced). Another would be to edit your image in photoshop and cut it up into 10 separate files using a transparent background. You could then add and remove layers to wherever you are displaying your image and control the z-ordering with vb.

Resources