Krita Source Code Documentation
Loading...
Searching...
No Matches
comics_project_management_tools.comics_exporter.sizesCalculator Class Reference

Public Member Functions

 __init__ (self)
 
 get_scale_from_resize_config (self, config, listSizes)
 

Detailed Description

Definition at line 31 of file comics_exporter.py.

Constructor & Destructor Documentation

◆ __init__()

comics_project_management_tools.comics_exporter.sizesCalculator.__init__ ( self)

Definition at line 33 of file comics_exporter.py.

33 def __init__(self):
34 pass
35

Member Function Documentation

◆ get_scale_from_resize_config()

comics_project_management_tools.comics_exporter.sizesCalculator.get_scale_from_resize_config ( self,
config,
listSizes )

Definition at line 36 of file comics_exporter.py.

36 def get_scale_from_resize_config(self, config, listSizes):
37 listScaleTo = listSizes
38 oldWidth = listSizes[0]
39 oldHeight = listSizes[1]
40 oldXDPI = listSizes[2]
41 oldYDPI = listSizes[3]
42 if "Method" in config.keys():
43 method = config["Method"]
44 if method == 0:
45 # percentage
46 percentage = config["Percentage"] / 100
47 listScaleTo[0] = round(oldWidth * percentage)
48 listScaleTo[1] = round(oldHeight * percentage)
49 if method == 1:
50 # dpi
51 DPI = config["DPI"]
52 listScaleTo[0] = round((oldWidth / oldXDPI) * DPI)
53 listScaleTo[1] = round((oldHeight / oldYDPI) * DPI)
54 listScaleTo[2] = DPI
55 listScaleTo[3] = DPI
56 if method == 2:
57 # maximum width
58 width = config["Width"]
59 listScaleTo[0] = width
60 listScaleTo[1] = round((oldHeight / oldWidth) * width)
61 if method == 3:
62 # maximum height
63 height = config["Height"]
64 listScaleTo[1] = height
65 listScaleTo[0] = round((oldWidth / oldHeight) * height)
66 return listScaleTo
67
68
69"""
70The comicsExporter is a class that batch exports to all the requested formats.
71Make it, set_config with the right data, and then call up "export".
72
73The majority of the functions are meta-data encoding functions.
74"""
75
76

The documentation for this class was generated from the following file: