berteh / ScribusGenerator

Create beautiful documents with data. Open source pdf (and Scribus) template and mail-merge alternative.
http://berteh.github.io/ScribusGenerator/
MIT License
243 stars 37 forks source link

ScribusGenerator not using To Frame Size in image frame settings #205

Closed drentsoft closed 3 weeks ago

drentsoft commented 1 year ago

Hi,

I'm using ScribusGenerator 3 for Scribus 1.5.8 (64 bit) on WIndows 10 Pro and Windows 11 Home. I'm trying to generate files from a CSV but a lot of the images that are being imported don't look like they've been applied. however if I go into the image frames' Contents Properties and toggle Proportional or To Frame Size (both selected in the original template file) then they suddenly appear, scaling correctly into place. Is there a workaround for this?

Part of the log file, the part where it actually generates one of the files. Please let me know if you need more, it's very long and the file paths are also long.

2022-11-09 17:37:58 - DEBUG - create_output_file:729 - computing output file name from menu_%VAR_card_variant%-generated (count is 16)
2022-11-09 17:37:58 - DEBUG - substitute_data:546 - Replacements updated: ['P', 'A', 'B', 'C', 'F', 'G', 'H', 'I', 'J', 'L', 'N', 'O', 'P', '../../../sourced_images/fungesFull-square.svg', '../../../sourced_images/shrimp-895011_1920-3-coloured.png', '../../../sourced_images/soup-576424-woodBowl2.svg', '../../../sourced_images/turkey-151756-square.svg', '../../../sourced_images/spare-ribs-575310-noPlate2.svg', '../../../sourced_images/salmon-575539-square.svg', '../../../sourced_images/pret_2-1024-square.png', '../../../sourced_images/strawberye-2-square.svg', '../../../sourced_images/gyngerbrede-brownieBase1-square.svg', '../../../sourced_images/meadMug-2.1-square.svg', '../../../sourced_images/pote-copos-singleCup-3.2.svg', '../../../sourced_images/container-41935.svg', '16']
2022-11-09 17:37:58 - DEBUG - create_output_file:734 - output file name is menu_P-generated
2022-11-09 17:37:58 - DEBUG - remove_empty_texts:809 - Removed 0 empty texts items

The images are a combination of SVGs and PNGs. I've manually edited the image links to use full variable paths for example: %VAR_appetiser_image1% = ../../../sourced_images/shrimp-895011_1920-3-coloured.png

In the first image below you can see the third row, third column is selected but no image shows (I assume due to scaling). In the second image you can see just by toggling proportional the image appears and is scaled correctly. The third image shows how the file was originally generated with several more "missing" images. The fourth image shows the settings I'm using to export.

Thanks,

Derwent

scibusIssue3 scibusIssue4

scibusIssue5 scibusIssue6

berteh commented 1 year ago

Hi Derwent. First time in see such an issue... but let's figure it out.

Since the images paths are properly replaced it does not seem to be a problem in your template, nor data, nor SG script, but rather in the way Scribus loads (or doesn't, actually) the images when opening the document.

Did you per chance notice if all the hidden images are of the same type (SVG maybe?), while the visible ones would be of another (PNG in your case)?

If that's the case, I would then guess Scribus makes an internal render/load of the vector images whenever an option is updated (resize, recheck 'fit to frame', URL change,...) that is missing from the SG-generated file.

We may then workaround the issue with a quick script that forces an update of all images.

If it's not related to a common extension, might there be something else that distinguishes the hidden images (or their frames) from the visible ones? Do the missing images always appear in the same frames ?

On a side note: your menu is looking good! Congrats! I like to try to keep displayed instructions in the game mood and would thus replace 'player' by 'guest', or similar... But it's just an idea 😅

drentsoft commented 1 year ago

Hi,

I just checked and it seems to be mostly SVGs that exhibit the issue (and one png) but it's not the same ones in each generated file and not every SVG is showing the problem. While it does seem most problematic in the middle 2 rows, column 1 and column 3 I can't even pin point it to the image frame itself because some will be displayed correctly and some will not.

As you can see from the image below:

Image I is the PNG that doesn't display correctly.

It's quite strange. I do wonder if it's a relative scale/DPI issue but I'm not sure how to check. The reason I think this is that image D always appears but with the bottom cut off, I think this is because the SVG is closest in size to the frame.

Thanks :) Yes I'm still working on wording for some things. Taster would be the best alternative to player in this case. 😃

scribusIssue7

drentsoft commented 1 year ago

AHA! I think I've worked it out! So. I "tested" the frames to get the initial paths that I could edit with the variables and in doing that each image frame ended up with a wildly different scale/actual DPI scale. That must have been tripping up the auto-scaling in Scribus.

I reset them all to 437% X/Y DPI (which was the DPI that seemed to give the best results all around) and reran it and it's much better! Now I just need to work out how to centre the images in the frames instead of having them be top left aligned

image

image

berteh commented 1 year ago

maybe this script helps to automatically resize all images at once ? it should have the same effect as re-applying the "fit to frame size + propotionally" option:

https://wiki.scribus.net/canvas/Scale_an_Image_to_Fill_a_Frame_Proportionally

drentsoft commented 1 year ago

Thanks for the script :)

berteh commented 3 weeks ago

I added your cards screenshot in the gallery at https://github.com/berteh/ScribusGenerator/wiki#other-games-cards if you'd like to take if off (or share some more/ related material for other to get inspiration) feel free to edit the page directly !