convert to jpg and split file in size about 24mb

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
patriquepagano
Posts: 5
Joined: 2012-12-14T16:16:15-07:00
Authentication code: 6789

convert to jpg and split file in size about 24mb

Post by patriquepagano »

Hello friends!!!

please someone help!

I want convert jpgs to pdf and in conversion split in 24mb file parts

example

a book have 100mb file size in jpgs files..

convert to pdf like this

part001.pdf (24mb)
part002.pdf (24mb)
part003.pdf (24mb)
part004.pdf (24mb)
..... etc...

in windows I use this code

Code: Select all

convert -compress jpeg -quality 80 c:\0lab\*.jpg imagecompress80.pdf
Please what command to do for split in 24mb pdf files???

excuse my bad english..

thanks for all!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert to jpg and split file in size about 24mb

Post by fmw42 »

I think you will either need to reduce the quality of the jpg before converting to PDF so that each jpg converts to a PDF of the right file size or you will have to resize the jpg to about 25% and then up the density to 288 to get the pdf to be smaller for each jpg.
patriquepagano
Posts: 5
Joined: 2012-12-14T16:16:15-07:00
Authentication code: 6789

Re: convert to jpg and split file in size about 24mb

Post by patriquepagano »

hello friend!!!

thanks for your repply!!!

I dont want to reduce quality.. I want to split file 24mb for each pdf

ex.

I have a book with 300 pages in jpg...

I can convert this lot of pages in one pdf with the size of 130MB..

I want to split in 24mb each pdf

understand?

excuse my bad english...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert to jpg and split file in size about 24mb

Post by fmw42 »

If the total of all your jpg files is larger than 130MB, then the only way to reduce size of the resulting PDF to 130MB is to reduce the size of each jpg file. The only way to do that is to either reduce the quality (more compression) or to make the images smaller is dimensions (width x height) by resizing them.

If you just want one pdf file for each jpg, then add +adjoin to your command so that you do not get 1 pdf file with multiple pages

convert -compress jpeg -quality 80 c:\0lab\*.jpg +adjoin imagecompress80.pdf
patriquepagano
Posts: 5
Joined: 2012-12-14T16:16:15-07:00
Authentication code: 6789

Re: convert to jpg and split file in size about 24mb

Post by patriquepagano »

Hello friend fmw42 thank you very much for your help!!

I really sory for my bad english.. I think I dont explain correct what I need.

for example..

I have a folder with 300 pages in jpg ok

If I convert to pdf I create one big file like 130mb..


I need when process create pdf split in files when reach 24mb.. like this

part001.pdf (24mb)
000.jpg
001.jpg
002.jpg
........ etc..
part002.pdf (24mb)
003.jpg
004.jpg
005.jpg
006.jpg
.... etc...
part003.pdf (24mb)
007.jpg
007.jpg
008.jpg
009.jpg
010.jpg
.... etc...
part004.pdf (24mb)
011.jpg
012.jpg
013.jpg
014.jpg
.... etc...

thanks for all tips!!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert to jpg and split file in size about 24mb

Post by fmw42 »

I am still not sure I understand. Is

part001.pdf (24mb)
000.jpg
001.jpg
002.jpg

all one single pdf separate from

part002.pdf (24mb)
003.jpg
004.jpg
005.jpg
006.jpg

which is another separate pdf file?

If so, the only way I know to do this is by scripting with loops. Create a list of all the jpg file sizes, then add them up until you reach 24MB and convert just those jpgs to a pdf. Repeat with the remaining jpgs for the next pdf file.
patriquepagano
Posts: 5
Joined: 2012-12-14T16:16:15-07:00
Authentication code: 6789

Re: convert to jpg and split file in size about 24mb

Post by patriquepagano »

hello friend! thanks for your patience with me :(

another example..

I have a book 300 pages in jpg ok

I know how to convert to only one pdf ok

but I want a command to convert this book into sequentials PDF about 24mb each one..

I wanto to send this book for email.. I want to split in readable pdfs understand?

email only suport 24mb attachments..

I can zip this file and split in parts.. but not will be readable direct in email...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert to jpg and split file in size about 24mb

Post by fmw42 »

Thanks, I understand.

The only way I know to do this is by scripting with loops. Create a list of all the jpg file sizes, then add them up until you reach 24MB and convert just those jpgs to a pdf. Repeat with the remaining jpgs for the next pdf file.

Suppose I add up the file sizes of 001.jpg 002.jpg 003.jpg and find it is under 24MB. But if I try to include 004.jpg, I find it is over 24MB. Then I would just do

convert 001.jpg 002.jpg 003.jpg -density xx 001.pdf

Then start adding from 004.jpg 005.jpg etc until you reach the next 24MB. The do the same command with these images and write to 002.pdf.

To find the image file sizes, you can use

convert 001.jpg -format "%b" info:

see
http://www.imagemagick.org/script/escape.php

you can get a list of all the file sizes by doing the following (in unix)

list=`convert *.jpg -format "%b" info:`

provided you just have only the jpgs you want to use in one directory. Or possibly use %03d.jpg in place of *.jpg
patriquepagano
Posts: 5
Joined: 2012-12-14T16:16:15-07:00
Authentication code: 6789

Re: convert to jpg and split file in size about 24mb

Post by patriquepagano »

Thanks friend for give me one direction!!

now I know where to learn to solve this problem thanks to you!
Post Reply