$ if(pixel_{offset} * \frac{dpi_{img}}{dpi_{ph}} = integer)$
In [94]:
import math
def calc_possible_dpi(interline_gaps, dpi_ph, ph_type):
possible_dpi = [] # dpi
for dpi_img in range(1,3000): # dpi
dpi_possible = True
for interlinegap in interlinegaps:
mult_int = int(interlinegap*(dpi_img/dpi_ph))
mult_double = interlinegap*(dpi_img/dpi_ph)
if (mult_double - mult_int) > 0:
dpi_possible = False
if dpi_possible:
possible_dpi.append(dpi_img)
print("Possible Resolutions of {}".format(ph_type))
print("dpi_img | dpi_img/dpi_ph")
for dpi_img in possible_dpi:
check_mod_2 = fmod((dpi_img/dpi_ph),(9.765625e-4))
if check_mod_2 == 0:
print("{:7} | {:14} <--- Possible in FPGA".format(dpi_img,dpi_img/dpi_ph))
else:
print("{:7} | {:14}".format(dpi_img,dpi_img/dpi_ph))
In [95]:
interlinegaps = [12,28,40] # px
dpi_ph = 360.0 # dpi
calc_possible_dpi(interlinegaps, dpi_ph, "Konica Minolta KM1024i")
In [96]:
interlinegaps = [20] # px
dpi_ph = 360.0 # dpi
calc_possible_dpi(interlinegaps, dpi_ph, "Konica Minolta KM1024")
In [97]:
interlinegaps = [13,279,292] # px
dpi_ph = 600.0 # dpi
calc_possible_dpi(interlinegaps, dpi_ph, "Ricoh GEN5")
In [98]:
interlinegaps = [0,20,70,80,90,100,150,160,170,180,220,230,240,250,260,300,310,320,330,380,390,400,410,460,480] # px
dpi_ph = 600.0 # dpi
calc_possible_dpi(interlinegaps, dpi_ph, "Kyocera KJ4B")