une photo numérique n'a pas de 'résolution native en dpi' puisque la taille de l'image en sortie du capteur est exprimée en mégapixels (pixels) et non pas dpi.
tout vas dépendre de la sortie papier pour la dégradation de l'image par rapport a ce qui est visible a l’écran.
ce qui veux dire que si on sort une image en 5776x4336 sur un support en 122x92 en 300 ppp
on pourra avoir en réalité une image recadrée 4x plus petite pour la même qualité
j'avais codé un logiciel il y a quelques années pour un forum photo ou j’étais modo .
Code : Tout sélectionner
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#String_0
#String_1
#Text_0
#Text_1
#String_3
#String_4
#Text_3
#Text_9
#Text_11
#Text_12
#String_9
#String_10
#String_12
#String_13
#String_16
#String_17
#Text_13
#Text_14
#Text_16
#Text_17
#Text_18
#Text_19
#String_18
#String_19
#Text_20
#Text_21
#Text_22
#Text_23
#button_1
#button_2
EndEnumeration
inch.f=25.4 ; 1 pouce en mm
If OpenWindow(#Window_0, 471, 160, 320, 540, "calculateur de dpi", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
StringGadget(#String_1, 10, 10, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_0, 10, 40, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_4, 10, 100, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_3, 10, 130, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_12, 10, 260, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_13, 10, 290, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_16, 10, 330, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_17, 10, 360, 110, 20, "", #PB_String_Numeric)
StringGadget(#String_9, 80, 180, 70, 20, "", #PB_String_ReadOnly)
StringGadget(#String_10, 80, 210, 70, 20, "", #PB_String_ReadOnly)
StringGadget(#String_18, 130, 390, 120, 20, "", #PB_String_ReadOnly)
StringGadget(#String_19, 130, 420, 120, 20, "", #PB_String_ReadOnly)
TextGadget(#Text_0, 130, 10, 110, 20, "resolution horizontale")
TextGadget(#Text_1, 130, 40, 110, 20, "resolution verticale")
TextGadget(#Text_3, 130, 100, 110, 20, "taille horizontale en mm")
TextGadget(#Text_9, 130, 130, 110, 20, "taille verticale en mm")
TextGadget(#Text_11, 30, 70, 200, 20, "mesures physiques de la taille de l'ecran")
TextGadget(#Text_12, 10, 180, 70, 20, "DPI Calcules")
TextGadget(#Text_14, 130, 290, 150, 20, "taille image verticale (pixels)")
TextGadget(#Text_13, 130, 260, 150, 20, "taille image horizontale (pixels)")
TextGadget(#Text_16, 130, 330, 180, 20, "resolution de sortie horizontale (ppp)")
TextGadget(#Text_17, 130, 360, 180, 20, "resolution de sortie verticale (ppp)")
TextGadget(#Text_18, 10, 390, 110, 20, "taille en mm en sortie")
TextGadget(#Text_19, 10, 420, 110, 20, "taille en mm en sortie")
;
TextGadget(#Text_20, 10, 450, 110, 20, "[c] 2009 Case pour")
TextGadget(#Text_21, 10, 470, 110, 20, "code en ")
;
TextGadget(#Text_22, 10, 490, 500, 20, "Freeware ne peut etre vendu ou distribue contre inscription")
TextGadget(#Text_23, 10, 510, 500, 20, "gratuite ou payante ni sur support payant sans l'accord de l'auteur")
ButtonGadget(#button_1,120,450,200,20,"pixel valley")
ButtonGadget(#button_2,120,470,200,20,"pure basic")
EndIf
Repeat
ev=WaitWindowEvent()
Select ev
Case #PB_Event_Gadget
Select EventGadget()
Case #String_0
ys.f=Val(GetGadgetText(#String_0))
Gosub calcdpi
Case #String_1
xs.f=Val(GetGadgetText(#String_1))
Gosub calcdpi
Case #String_3
sizey.f=Val(GetGadgetText(#String_3))
Gosub calcdpi
Case #String_4
sizex.f=Val(GetGadgetText(#String_4))
Gosub calcdpi
Case #String_12
img_x.f=Val(GetGadgetText(#String_12))
Gosub calcdpi
Case #String_13
img_y.f=Val(GetGadgetText(#String_13))
Gosub calcdpi
Case #String_16
outdpi_x.f=Val(GetGadgetText(#String_16))
Gosub calcdpi
Case #String_17
outdpi_y.f=Val(GetGadgetText(#String_17))
Gosub calcdpi
Case #button_1
RunProgram("http://www.pixelvalley.com")
Case #button_2
RunProgram("http://www.purebasic.com")
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
calcdpi:
If xs<>0
taillepixelh.f = sizex/xs
EndIf
If ys<>0
taillepixelv.f = sizey/ys
EndIf
If taillepixelh<>0
ppph.f=inch/taillepixelh
EndIf
If taillepixelv<>0
pppv.f=inch/taillepixelv
EndIf
If outdpi_x.f<>0
img_inc_x.f=img_x/outdpi_x
EndIf
If outdpi_y.f<>0
img_inc_y.f=img_y/outdpi_y
EndIf
;
Debug img_inc_x
mm_out_x.f=img_inc_x*inch
mm_out_y.f=img_inc_y*inch
SetGadgetText(#string_9,Str(ppph))
SetGadgetText(#string_10,Str(pppv))
SetGadgetText(#string_18,Str(mm_out_x))
SetGadgetText(#string_19,Str(mm_out_y))
Return