Skip to content

Lisliane/transform_images_into_single_pdf

Repository files navigation

Gerar arquivo pdf a partir de várias imagens

(Generate pdf file from multiple images)

Repositório com scripts para tratar imagens em determinada pasta, e transformá-las em um único arquivo com extensão pdf.
Scripted repository to process images in a given folder, and transform them into a single file with a pdf extension.

Configurações

(Setup)

Python versão 3.7.1
Python version 3.7.1

Instalar dependências

(Install dependencies)

Clone o repositório git e instale os requerimentos:
Clone the git repository and install the requirements:

git clone https://github.com/Lisliane/transform_images_into_single_pdf
cd transform_images_into_single_pdf
virtualenv -p python3 env
source env/bin/activate
pip install -r requeriments.txt

Imagens que serão transformadas

(Images to be transformed)

Acrescente as imagens que serão transformadas em PDF na pasta:
Add the images to be converted to PDF in the folder:

imgtopdf/in

Dica:
(Tip:)

Caso não sejam .PNG, mude o valor da variável EXTENSION_TO_EDIT em:
If they are not .PNG, change the value of the EXTENSION_TO_EDIT variable to:

imgtopdf/utils/settings.py

Como utilizar

(How to use)

Para executar:
To execute:

cd imgtopdf/
./main.py --option=1 --lang=PTB

Onde:
Where:

--option: 1-Trata imagens e gera PDF 2-Apenas gera PDF
--option: 1-Treats images and generate PDF 2-Generates PDF only

--lang: Define idioma. Opções: PTB (português) ENG (inglês)
--lang: Defines language. Options: PTB (portuguese) ENG (english)

Para alterar as constantes, edite o arquivo:
To change the constants, edit the file:

imgtopdf/utils/settings.py

Resultado

(Result)

O arquivo final estará na pasta:
The final file will be in the folder:

imgtopdf/out/result

Dica:
Tip:

  • Caso deseja mudar o nome do arquivo final .PDF, mude o valor da variável DESTINY_PDF.
    If you want to change the name of the final .PDF file, change the value of the DESTINY_PDF variable.

  • Caso deseja mudar as margens, mude o valor das variáveis PDF_X e PDF_Y.
    If you want to change the margins, change the value of the variables PDF_X and PDF_Y.

imgtopdf/utils/constant.py

Estrutura das pastas

(Folders structure)

As pastas foram organizadas da seguinte forma:
The folders were organized as follows:

  • imgtopdf: pasta principal da solução, contendo o arquivo main.py, que executa.
    imgtopdf: main folder of the solution, containing the main.py file, which is executed.

  • imgtopdf/in: onde as imagens originais devem ser colocadas. A partir desta pasta, as imagens são tratadas e consequentemente, geram o arquivo final.
    imgtopdf/in: where the original images are to be placed. From this folder, the images are processed and, consequently, generate the final file.

  • imgtopdf/out/edited: onde as imagens são trabalhadas.
    imgtopdf/out/edited: where the images are worked.

  • imgtopdf/out/result: pasta com o arquivo pdf gerado.
    imgtopdf/out/result: folder with the generated pdf file.

  • imgtopdf/image_process: classes que processam as imagens, subdivido em:
    imgtopdf/image_process: classes that process the images, subdivided into:

  • imgtopdf/image_process/crop: corta as margens externas da imagem.
    imgtopdf/image_process/crop: crop the outer edges of the image.

  • imgtopdf/image_process/file_manage: copia, leitura e gravação de imagens.
    imgtopdf/image_process/file_manage: copy, read and write images.

  • imgtopdf/image_process/he: equalização de histograma.
    imgtopdf/image_process/he: histogram equalization.

  • imgtopdf/image_process/retinex: aplicação de retinex na imagem.
    imgtopdf/image_process/retinex: retinex application on the image.

  • imgtopdf/image_process/rotate: auto rotação da imagem.
    imgtopdf/image_process/rotate: auto image rotation.

  • imgtopdf/pdf_generate: classes que criam o arquivo PDF.
    imgtopdf/pdf_generate: classes that create the PDF file.

  • imgtopdf/utils: classes comuns entre as funcionalidades.
    imgtopdf/utils: common classes between features.

Resultado pyreverse

(Result pyreverse)

pyreverse imgtopdf -o project.png

Classes

(Class) Alt text

Pacotes

(Packages) Alt text

Autora

(Author)

Lisliane Zanette de Oliveira ([email protected])

About

Transform various images into a single pdf

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages