• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Data merge: Clear space of empty images

Explorer ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

Hello everyone,

after a lot of research, I still couldn't find a viable solution to a problem. I want to stack a couple of images in a text frame. The images are selected via data merge.

Now my problem is that empty images will still take space and don't collapse:

65b797d6028d880c94514dd7872e4187.png

Each image here comes from a separate column in the dataset:

@IMG1@img2@img3@img4@img5
neutral.pngneutral.pngneutral.pngneutral.png

What I want is that if one or more images are not set, everything aligns to the left. But I couldn't find a way to collapse empty frames or scale the frame to a smaller image (a blank.png of sorts).

I'm running out of ideas so I'm starting to think I'll have to resort to a script, which I'd prefer to avoid since then previewing the merge will not look correctly.

Has anyone ever managed to solve this problem? This is the second time I'm running into it, already. Last time I solved it with a complex excel formula to automatically sort the columns.

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Aug 15, 2019 Aug 15, 2019

My tabbed text file:

@test @test2 @test3 @test4 @test5

/Users/JK/Desktop/normal.png /Users/JK/Desktop/small.png /Users/JK/Desktop/normal.png /Users/JK/Desktop/normal.png /Users/JK/Desktop/normal.png

Bildschirmfoto 2019-08-15 um 12.01.35.png

Bildschirmfoto 2019-08-15 um 12.01.46.png

It works, but be careful:

Bildschirmfoto 2019-08-15 um 12.03.44.png

What doesnt work, is preparing the boxes with auto-adjust options. They will be overwritte i guess by the data-merge options.

I choose "fit frame to content", which works in my example. I took a 200px width screenshot (gray color) and a red pixel thingy image.

But there will be a

...

Votes

Translate

Translate
Guide ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

so, you have empty cells here and there in different records, and can't predict how many empty fields you will have finally, right?

In this case yes, you will need a script to not adjust this manually.

To collapse the gap, you have to remove the image field from layout or change its properties. But Data Merge is designed to fill the ready containers with needed content, not to change the containers themself. You could expect that the omages would behaviour like text symbols (if the field empty, there is nothing in its point). But inline graphics is still graphics, its frames can't disappear such simply

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

The only way I know of would be via a data merge plug-in such as the one I use by Em Software. I suspect catalog plug-in can as well (but I believe are a more costly option).

As mentioned, it can likely be scripted that can detect if a frame is empty and remove it. You could inquire in the scripting forum.

Mike

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Heres an idea:

Set the image-container to auto-adjust and instead of using none image, create a placeholder with 1 pixel image.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

this may work

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

My tabbed text file:

@test @test2 @test3 @test4 @test5

/Users/JK/Desktop/normal.png /Users/JK/Desktop/small.png /Users/JK/Desktop/normal.png /Users/JK/Desktop/normal.png /Users/JK/Desktop/normal.png

Bildschirmfoto 2019-08-15 um 12.01.35.png

Bildschirmfoto 2019-08-15 um 12.01.46.png

It works, but be careful:

Bildschirmfoto 2019-08-15 um 12.03.44.png

What doesnt work, is preparing the boxes with auto-adjust options. They will be overwritte i guess by the data-merge options.

I choose "fit frame to content", which works in my example. I took a 200px width screenshot (gray color) and a red pixel thingy image.

But there will be a problem, if your actual images, because of resolution, blow up the imagebox. You could batch-convert the images to output size tho then.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

DBLjan​'s solution sounds like it should work. I couldn't find the option to fit frames to content when I was looking for it last time. I shall look again. The only issue I can imagine is wanting that option for some frames and not for others.

I was looking around for useful plugins, but so far everything I could find was quite expensive.

The one-pixel gap should be fine, maybe I can fix it with a negative offset somewhere.

Thanks, everyone, for the responses! I really wish they'd add more flexibility to the data merge feature. For me, it's the only reason I ever use InDesign.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

How to work with contextual text and images | InDesign | lynda.com - YouTube

Did you know, you can assign conditions (of conditional text) to anchored objects, and visually swap out images, or just show/unshow. Maybe this can help too.

As for the DM-options: Use the context-menu of the window ("hamburger menu", like |||| but 90° rotated) or the option-tab of the "generate merged document"-window, shown above (german client).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Hello there.

I would use a solution quite similar to the method outlined by DBLjan, relying on empty results being assigned an image that is really tiny and called something like blank.pdf,  data merge's frame fitting options are set to fit frames to images, and the images being placed as inline graphics next to each other. I've written more about this in a piece I wrote for InDesign Magazine issue 52 https://indesignsecrets.com/issues/issue-52-data-merge . I've used this technique in real-world examples as well.

Here's how it works:

The way to solve this is to make the image frames shrink to an almost unnoticeable size. This is done by creating "blank.pdf" in Illustrator – a blank page with only one object in it measuring 0.001mm square with no fill or stroke.

blank.png

Before beginning the merge, place the blank.pdf into InDesign making sure the show import options checkbox is checked. When the options appear, select Art from the dropdown menu.

blankety.png

This will mean that any PDFs linked via the data merge will also use this option, so the incoming graphics must be the correct size prior to the merge.

Lastly, the Fit Frames To Images setting in the content placement options needs to be selected.

fitframes.png

In the database, and making sure any missing image data is replaced with the blank.pdf link.

The advantage is that this will work whether the graphics need to be aligned to the left, right, or center.

The alternate way that will work if left aligning only:

This still relies on the data merge placeholders being inline graphics placed next to each other, but doesn't require a blank.pdf.

Take a database like this in Microsoft Excel. The columns represent each placeholder:

Screen Shot 2019-08-15 at 22.11.45.png

It's obvious I want it to be more like this:

Screen Shot 2019-08-15 at 22.14.14.png

To do this, all the blank cells need to be selected and deleted, with the content shifting to the left. To do this, highlight all the data and in Excel, go Edit, Find, Go to... and in the next dialog box, click the Special... button and then select blanks and click OK.

Screen Shot 2019-08-15 at 22.16.21.png

This will highlight all blank cells.

Screen Shot 2019-08-15 at 22.13.52.png

You can now right-click on a highlighted cell and click delete, and in the next dialog, click shift cells left

Screen Shot 2019-08-15 at 22.17.36.png

This way, you don't have to make a blank.pdf and the images will still align to the left. hope this helps

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Doh! I should not get tired of referring to Colin Flashman​ as expert for DataMerge – which i did not this time, but he is – as you see above. Im just a guy with ideas.

But I think both of these ways are not perfect: My problem is, that I have to hard-limit/photosphop-batch the dimension of my images upfront, before I let InDesign fit frames to images » its only applicable to the blank.pdf because its small, but most of our hi-res-images fall short with this method, resulting in vast image-boxes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Thanks for the indepth explanation, Colin!

So the idea with the PDF is to create a gap even smaller than a pixel, is that correct?

The excel solution won't really work for me since I update the sheets a lot and need as much automated as possible. I have to use a second sheet anyway to translate the data for indesign (e.g. turn icon: 5 into @icon: 5.png). So theoretically I can use formulas to move the data left or right. But it can be pretty slow or very ugly formulas.

But I guess it's a good fallback to have if nothing else works.

DBLjan​: Fortunately my images have the same resolution as the indesign document, so I don't have to rescale them. Maybe it can be solved for you by scaling the container of the image boxes by the correct factor?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

LATEST

About conditional texts - I was aware of that feature's existence, but since I can't let data merge drive the conditions (which would be so useful, you hear that, Adobe!!), I never considered them useful.

I really wish Adobe would collect all these ugly workarounds and add proper features to solve them. But then, I suppose, they're more in the business of buying products than developing products these days. *grumble*

But yeah, I'm glad you guys helped me solve this problem. I guess I'm just annoyed that my documents are barely maintainable with all the workarounds, and the complexity just multiplies once you need multiple of them at once.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines