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
46 percentage = config["Percentage"] / 100
47 listScaleTo[0] = round(oldWidth * percentage)
48 listScaleTo[1] = round(oldHeight * percentage)
49 if method == 1:
50
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
58 width = config["Width"]
59 listScaleTo[0] = width
60 listScaleTo[1] = round((oldHeight / oldWidth) * width)
61 if method == 3:
62
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