Scribus Forums

Scribus => Beginner Talk => Topic started by: pierruel on December 14, 2018, 09:04:09 AM

Title: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 14, 2018, 09:04:09 AM
Good morning everybody,
I'm editing a music score and (for technical reasons) my contents are on .jpg format. Each A4 page = one jpg file. Since today the "import image" feature doesn't work correctly: jpg files I want to import seem empty. I checked them with my picture editing software and they are all right. Does it happen because there are too much pictures in my score ?
Thank you for any help.
regards
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 14, 2018, 10:03:00 AM
you're probably seeing the top left corner of the image...

- open the "window > properties" palette
- scale the content to the frame

(http://forums.scribus.net/index.php?action=dlattach;topic=3149.0;attach=2807;image)

you can change the preferences (for future documents) and the document settings (for the current document) to get the new image to automatically scale. it's in the "tools > image frame" section.

btw, you probably know that jpg is a bad format for content with sharp contours...

[attachment deleted by admin]
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 14, 2018, 11:35:39 AM
Thank you a.l.e.,
My post wasn't clear enough, sorry: when I'm in the "import a picture" window, if I select a picture, a thumbnail of the selected picture normally appears in the small window on the right. In my case there is no thumbnail appearing, although the concerned picture exists (and occupies btw the whole space of the A4 format minus margins).
I wasn't aware about the picture's format: which one would be the best (unfortunately I imported already more than 100 pages/pictures ! Is it possible to convert them to another format inside Scribus or should I convert them in a picture editing software ?)
Thank you in advance
regards
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 14, 2018, 02:15:15 PM
salü pierre

so, you don't get the preview when clicking on the image?
but can you load them in an image frame?
if it does not load in an image frame, can you upload one of those images so that we can test it?
if it does load, and your problem is that it's harder to see which image you're importing, you might be able to drag and drop your images directly from a file manager or picture browsers (depending on your setup it will work or not).

finally, converting the existing images to a different format won't help.
you would have to regenerate the images from the original software...
next time, try to export to png or tif instead of jpg...
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 14, 2018, 02:47:11 PM
Hi a.l.e.
Thank you for answering.
I don't get the preview (I get a structured background) and if I click on it I get a blank (empty) image in my image frame. But the most funny (peculiar of course !) is that I imported successfully 135 pictures before the problem occured. The weight of the .sla file is 346 Ko, the reason why I asked about a maximum weight permitted.
The images are produced by my music notation software, which can export under .jpg, .bmp and .png formats, the best one beeing .png if I understand well.
What dragging from a picture browser is concerned, can I use Picasa to do it ?
Is it foreseeable that the same issue would appear (or not) if loading 135 and more pictures in .png format into my .sla file ?
Thank you for your patience !
Regards
Pierre
P.S. The weight of my pictures with the .jpg format is between 700 and 1100 Ko each but I see that their weight is not added to the one of the .sla file, isn't it ?
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 14, 2018, 05:13:18 PM
eh eh... i think that you need to learn a few more things about images and layout...

the main difference between png and jpg is that jpg changes your image when saving it. it has been created for photos...

also, scribus does not (by default) include the images in the .sla. it just links to them. so, don't try to move the .sla or the images after you have linked them (if you want to move your project you need to use the "file > collect for output" tool).

finally, if you have an issue with a specific image (and if the image does not contain "huge" secrets, you might want to upload it here, so that we can have a look at it...
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 14, 2018, 11:12:35 PM
Of course I've to learn more about pictures, especially when they are numerized, but I think that the problem is elsewhere.
Please look what I wrote: I'm working on a music score where 1 page A4 = 1 picture. On a very  plain logical level, why was I able to import without any difficulty 135 pictures and not the 136th ? There is no matter of pictures' format nore display. Something works very well for 135 pages and then stops working for the 136th, who can explain ?
I would be very grateful for an explanation.
Regards
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 15, 2018, 08:19:46 AM
i don't see any reason why you should not be able to load a 136th image if the 135 before that were ok.

when there is a memory (size) problem, scribus normally lets you do what you wanted to do and then fails on opening the file next time you try to open it.

can you load the image number 136 in a new scribus file with no images in there yet?
if you cannot do so, then it's that specific image that is at fault.

please remember, that we don't see what is on your monitor and we don't know what you already have tried.
except if you tell us...
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 17, 2018, 12:03:54 AM
All right a.l.e. it's not easy to figure things without seeing anything. I just hesitate to attach too many screenshots.
First of all I don't see any reason either and I hope to understand what happens with the help of the forum.
I did as you wrote: created a new file called test_img.sla and tried to load the pictures which failed to load in my score. What a surprise: I was able to load 3 of them, including the one who refused to load into my real file and then I was stuck again (that test file has 10 pages of which 3 contain a picture). The attached shot "7_img" shows a display of my picture editing software with a series of pictures including the last one I was able to load and the following ones: all contain staves and notes but if I insist importing them I get empty images.
My Scribus is slow to open but it opens itself each time. Already the preview is empty, as shown on a second screenshot.
My demonstration is not perfect because it doesn't show what happens with one same and specific image, sorry; it's because there are no numbers on the images and the bar nombers are much too tiny to be seen. I'll try and make a more accurate test but it takes more time.
Hope the above will be helpful.
Thank you very much.
Regards
Pierre



[attachment deleted by admin]
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 17, 2018, 08:32:43 AM
so, you have a lot of jpg files and want to create one pdf out of it?

just that?

one the one side, there might be easier ways to do it (at least if you know how to write a script : - ).
scribus is not a bad tool for that (you can even automate the task by writing a script: not that i imply that you should do that) but, indeed, you might get a memory problem with all those big images.

from the screenshots, you seem to be on windows... and you could try to select all the jpg files in the file manager, in the context pick the "print" command and choose "to pdf" as the printer. i have no idea how good the result is... but it might be worth a try : - )

for linux i'm pretty sure that in 15 minutes i should be able to write a script for you that creates the pdf...

anyway:

- you have rather big images
- with some images you can load lot of images in one file, with other ones just 3...
- the same image works in one file but not in the other.

are the assertions above correct?

if yes, it would be good if you could give access to all your images (privately share a zip file with all the images and the .sla through framadrop or dropbox)... in the worst case you get a pdf with the job done... in the best case a solution for your issue...
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 17, 2018, 10:33:10 AM
Good morning, a.l.e.
I'm not sure I understand everything you wrote. English isn't my mothertongue.
What I want is simply to have a score of a musical piece I've composed.
The way I choosed is to edit a brochure with Scribus, but Scribus doesn't know how to write a musical text; I must export the musical text out of my music notation software in a picture's format; I did it on .jpg format but it's not the better way, you said, and I'll change for png, and then import the .png into Scribus. And then export to .pdf for printing.
But the point is that I did it already once with a former version of my musical piece. I've on my desk a brochure of 154 pages which is the first version and I encountered no problem when editing it.
I have a lot of .jpg files but I don't want just to create pdfs out of them, I want to publish a score in the form of a A4 brochure.
I could print all my .jpg to pdf but I want to have my stuff printed in a print-shop where they have high quality numeric printers with far better results than with my desktop printer. And they'll make a handsome brochure of my pages.
Your three assertions are correct and I'll look how I can make a zip file from my pictures (I never had to do that in 30 years computing but I'll learn ;-) )
I'll be back soon.
Best regards
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 17, 2018, 11:03:12 AM
if all you have is a lot of jpg and you want create a pdf that contains all jpg, one per page, scribus won't improve the quality the result.

all you have are lot of jpgs in a pdf at their original quality.

using png or tiff is normally a better choice, but jpg at 100% quality (or close to it) are not that bad, as long as you never edit them.

for creating a .zip file, open your file manager, right click on the directory where your .sla and .jpg are and choose "compress". this will create a zip with all the contents of the directory.
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 17, 2018, 11:19:33 AM
Thank you a.l.e.,
Tell me if I understand well: you mean that I've to convert my about 150 jgp to about 150 pdf and have them printed. The problem is that at my print shop they charge 8 CHF (about 6 to 7 euros) for opening one pdf file from a usb key. So I'll have to pay about 900 euros before they begin to print anything ! My 150 pictures must be in the same and unique pdf file. Perhaps in something else than a .sla file exported to pdf but I know no other solution and I worked with Scribus successfully for years, even on a 150 pages musical score as I said. How do you say "aporie" in English ?
Best regards
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: utnik on December 17, 2018, 12:28:02 PM
hi pierre

Quote from: pierruel on December 17, 2018, 11:19:33 AM...My 150 pictures must be in the same and unique pdf file.

for this i would use pdfsam (https://pdfsam.org/download-pdfsam-basic/) – at least if you already have .pdf files.

what export formats are possible with your source program?

utnik
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 17, 2018, 02:42:25 PM
no, not one pdf per jpg... one pdf for all jpg...

something like "convert *.jpg book.pdf" with imagemagick
(it's also available for windows but doing it on the command line is not something everybody wants to do....).

all in all, 150 pages full of full page jpg can consume lot of RAM, so you computer might or not be able to handle it:  scribus will be loading all the images in memory.
there are tricks for better handling it... but, at the end, scribus does need to load all images in RAM at once when it creates the PDF.

no idea why in this specific case this is not working for you.
if it's true that it has been working in many similar cases on the same computer and now it does not, then there is little that can be said without seeing the files.

oh, i have never heard of the word "aporie"... i must be a positive guy : - )
Title: Re: Maximum "weight" of a Scribus file ?
Post by: dragonfly on December 17, 2018, 03:26:19 PM
I will add a few tips, hopefully not taking you off course.

1. You might share notes with other creators of music scores.
Further into this (admittedly very long) thread ...
http://forums.scribus.net/index.php/topic,3042.0.html
it became clear that the author was using lilypond for creating music scores.

2. Lilypond can create SVG or other formats such as JPG. Import SVG into Scribus renderframe not imageframe.

3. Another tool ... Pandoc ...
https://pandoc.org/
allows PDF files to be concatenated.
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 17, 2018, 04:00:49 PM
Thank you, utnik, dragonfly and a.l.e.
My source can export under .pdf format. I'll look for pdfsam.

I know what lilypond does but if I must learn how to write 27 minutes of music with it, it will take more time that I own.

When I bought my first computer, for 4-5 years it didn't master anything but command lines of MS-DOS. I'm a very old newbie, you know.
Quoteif it's true that it has been working in many similar cases on the same computer and now it does not, then there is little that can be said without seeing the files.
Of course it's true ! The existing Scribus made score weights more than one pound; else I would have sent it attached to an e mail.
As I said, my computer did it one or two years ago, why does it fail this time ? This seems like sort of an aporia. There is an example in the attachement (sorry, it's Microsoft Word) with an URL to a very long excursus.
Now let's see what pdfsam is.
Thank you everybody.
Pierre

[attachment deleted by admin]
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 17, 2018, 04:21:35 PM
yeah... but, now let's try to get to the goal.

can you please:

- create a zip file with all your .jpg and your .sla inside of it. (you just have to right click on the folder with all the file and run "compress".
- upload it to https://framadrop.org/
- share the link with me or any other user who dares to look at it via private message.

of course, joining the pdfs with pdfsam will probably work ok.  and -- if it works -- it's probably a better solution than composing the pdf with scribus.
for this specific case.

if you want to try that way. do it.
if it does not work, please send the link to the file : - )
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 17, 2018, 06:31:15 PM
Hi,
My pdf files and the sla I was able to build are at:
https://framadrop.org/r/VcS-ITF-7N#a2Zrpmp8oQamVkdZ73cvHU5LUVGChnE1fALo8b5zMaE=
Perhaps the problem comes from other softs running while I import pictures into Scribus. I'll redo my initial export to png files and make a new try.
What that old Windows bike did once will be done again, by Jove !
Good evening
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 17, 2018, 07:31:31 PM
Good evening,
No benefit with .png files. Windows file manager shows that my .png files contain staves and notes (my notation soft exports all right), but
- in my old picture editing software (Photostudio) the pictures can't be opened ("pictures format not supported or corrupted files")
- in Scribus no picture at all is imported, only the filename of the image
- in The Gimp they are imported as full black pages.
Another mystery isn'it ?
Regards
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 17, 2018, 09:24:46 PM
the images seem to work of with scribus 1.5
the same for 1.4.

i gave it a few tries and did not found any issue.

first, i had to amke sure that the image files are shown in order (eventually rename the files with -1.jpg, -2.jpg to -01.jpg, -02.jpg and so on... )
on windows the order might be more intelligent, but here i needed to add the missing zeros to the filenames to get the right order.

then, a few hints for the workflow

with 1.4

- in the file > document settings > tools > image frame set the image to automatically fill the frame (by default)
- with shift click create an image frame that fills the page
- load the image
- item > adjust frame to image
- page > snap to guide
- move the frame down to the bottom margin
- keep the properties palette open to see the position and size
- insert > frames and insert on all pages with the position and size you see in the properties palette
- remove the double you already did import
- drag each image from a file manager (this works for me on linux... i don't see why it should not work on windows...)

with scribus 1.5

- in the file > document settings > tools > image frame set the image to automatically fill the frame (by default)
- with shift click create an image frame that fills the page
- load the image
- item > adjust frame to image
- page > snap to guide
- move the frame down to the bottom margin
- copy the y position
- edit > master page
- page > manage guides and add an horizontal by pasting the y position of the item
- (do it for both master pages)
- close the editor
- delete the image frame
- zoom out to see many pages
- create an image frame on the first page
- open the load image dialog and select all the images in the directory
- click on the first image frame to fill it with the first image
- shift click on the lower part of each page (in the right order) to fill the part below the guide with the new image
- repeat for each empty page.

but, well, it's a lot of images.

i've created a simple python script that fills all frames with the files in a directory.
(based on https://wiki.scribus.net/canvas/Automatic_import_of_images_from_a_directory_using_a_script)


# - get the directory with all images
# - on the first page where you want the image create an image frame of the right size
# - select the empty image frame
# - run the script
# - the script copies the frame, then loads the first image in the exiting frame
# - then on other following pages paste the emtpy frame and load the next image
# - if there are not enough pages, create them to put all the images in the directory
import os
import sys
import scribus

if not scribus.haveDoc():
    scribus.messagebarText("No .")
    sys.exit()

if scribus.selectionCount() == 0:
    scribus.messagebarText("No frame selected.")
    sys.exit()

if scribus.selectionCount() > 1:
    scribus.messagebarText("Please select one single frame.")
    sys.exit()

master_frame = scribus.getSelectedObject()

x,y = scribus.getPosition()
width, height = scribus.getSize()


path = scribus.fileDialog("Pick a directory", scribus.getDocName(), isdir = True)
if path == '':
    scribus.messagebarText("No directory selected.")
   

extensions = ['jpg', 'png', 'tif']
filenames = [f for f in os.listdir(path)
              if any(f.endswith(ext) for ext in extensions)]

if not filenames:
    scribus.messagebarText("No image found.")
    sys.exit()

# sorted(filenames)
filenames.sort()

scribus.loadImage(filenames[0])
filenames = filenames[1:]

page = scribus.currentPage() + 1
n_pages = scribus.pageCount()

for filename in filenames:
    print(filename)
    if page <= n_pages:
        scribus.gotoPage(page)
    else:
        # TODO: currently this does not work if there are multiple master pages
        # (facing pages). you need to create all pages before loading the images.
        scribus.newPage(-1)
        scribus.gotoPage(scribus.pageCount())
    new_image = scribus.createImage(x, y, width, height)
    scribus.setScaleImageToFrame(True, True, new_image)
    scribus.loadImage(filename, new_image)
    page += 1


you can download it from

https://raw.githubusercontent.com/aoloe/scribus-script-repository/master/load-images/load-images.py

put it somewhere and run it with "script > execute scripts..."

it loads the 150+ images in about 20 seconds...

just one warning: the scripter currently cannot create new pages if you have a facing pages document (i have created a ticket for this: https://bugs.scribus.net/view.php?id=15515).

voilà, finally, this is the document with all images in there (created with my script):

https://framadrop.org/r/yg2gspfiwo#uAsPscgwnLSl/D87QYmqeieIwWkgAYoKhmjTxzdfZqw=

bonne chance!
a.l.e
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 18, 2018, 09:32:35 AM
Thank you a.l.e,
I wasn't able to get your answer until this morning.
I went directly to "Notes.sla" and opened it. It contains 165 filenames ending with .jpg but no picture. My Scribus ver. is 1.4.7. I made sure that notes.sla and the 165 .jpg files are in the same directory. Perhaps they shouldn't ?
I've some practice with VBA for Excel but never with Python.
I'm sorry
I'd understand if you lose patience.
regards
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 18, 2018, 12:43:46 PM
i've downloaded my own zip and opened with my scribus 1.4: i see all the images.

i also "manually" checked the full-ale.sla and it looks correct.

for what i can tell from here, it looks like a memory issue on your computer... but it's hard to say.
and if you cannot "correctly" open my .sla (and you're not doing a "stupid" error... something that can always happen...) the python script won't really help.

finally, here is the pdf i can generate from my .sla:

https://framadrop.org/r/ZbYdHIOswR#Oe97lk69FUunFOVkIm/OxGgxmfAJo4Lk03E5sZ7fPW8=

we both live in the same small country, but -- probably -- as much as it is possible, so i cannot take a train and come over to see what's happening on your computer...

Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 18, 2018, 02:11:07 PM
Thank you a.l.e.
Your pdf is splendid.
I have only two regrets.
I did'nt get the answer to my question (why some years ago and now no more ?)
I can't add "têtières" changing at each part and a "Contents" page (têtières are these small lines of text at the top repeating on each page the title of the book and the number of the chapter).
My RAM is 8 Go, it should be enough, isn't it ?
I'll try to finish the job in two volumes of about 80 pages each. I don't know if Scribus can put page numbers beginning on a specific number like 85, I'll see.
Thank you for everything and thank you to dragonfly and utnik too.
Regards
Pierre
P.S. a.l.e don't take the train but you don't need to do so. You can handle with my PC without standing up from your chair. If you feel like. But wait some time, I have to work on my solution.
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 18, 2018, 03:38:47 PM
the answer to your question

"""
I did'nt get the answer to my question (why some years ago and now no more ?)
"""

was a bit hidden and was not a real answer:

no idea.
from what i can tell it looks like a memory (RAM) issue... except if you did a "stupid" error (and stupid errors do also happen to the best ones!).
it's hard to say from here why your scribus cannot manage your images anymore.
my computer with my scribus did manage it... so the issue does not seem to be related to scribus or the images.

finally, if you provide me a .sla  with the master pages correctly setup (page numbers, headers...) and one page with a big image frame for the notes, i can easily send you a pdf with all the note sheets in there!
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 19, 2018, 12:19:40 AM
Hi!
In the meantime I tried the solution I was talking about: to divide my score into two parts of about 80 pages each. The first part existed, I just had to cut pages after the 79th.
In the second part I was able to import more than 50 pictures without any problem. I was stopped because the rest weren't "détourées" (cut around in order to eliminate too wide margins with irrelevant texts) and I didn't feel like doing it tonight.
The remaining problem is that in part 2 pages are numbered from 1, instead of from 80. Shall I number them manually ? I thought about writing a small script on the theme "write here the page number + 79" but Python isn't my cup of tea, alas.
Well, I have not much skills but I have time to do things manually, everything ok.
Have a fine day tomorrow
Pierre
Title: Re: Maximum "weight" of a Scribus file ?
Post by: a.l.e on December 19, 2018, 09:00:28 AM
- File > Document Setup.
- Activate the "Sections" section.
- Set the "Start" value for the "main" section.

(http://forums.scribus.net/index.php?action=dlattach;topic=3149.0;attach=2814;image)

[attachment deleted by admin]
Title: Re: Maximum "weight" of a Scribus file ?
Post by: pierruel on December 19, 2018, 10:24:30 AM
Marvelous. Seems so easy when you reply.
Many thanks.
regards
P.