Html nokta boyutu içine piksel dönüştürmek nasıl?

1 Cevap php

I kullanıcı metin görüntüyü yeniden boyutlandırmak benim projede, nokta boyutunu içine benim piksel dönüştürmek için tüm sevgili istiyorum, o nokta boyutunu kullanarak genişliğine göre yeniden boyutu olmalıdır?

her biri herhangi bir fikrin var mı?

1 Cevap

1 pixel= 0.264583333 mm,
1 mm = 3.779527559 pixel
according to translatorscafe.com
but in reality Pixel is a relative measurement, which depends on your screen resolution. You can't actually convert a relative measurement correctly into a fixed measurement, you can only approximate it. And the correctness of the approximation depends on how accurate your assumptions are, in this case the assumption is 1 pixel = 0.264583333 mm

Assuming for example my case: I have a resolution of 1920 x 1080 pixel (according to windows display settings). Then I have an 18 inch monitor on my laptop. That means 18 inch in the diagonal, and since 1 inch is 25.4 millimeters (according to google), this makes 457.2 mm in the diagonal (according to calc.exe). Assuming furthermore that a pixel is relative to mm equally in length as in width, that means monitor is 1080/1920 th times as heigth as it is with. Using the pythagoran theorem a^2 + b^2 = c^2 = 457.2^2 mm^2 and a is x and b is 1080/1920 x we have (x)^2+ (1080/1920 x)^2 = 457.2^2 mm^2 Solving for x results in 398.4843356 mm (according to Casio Classpad 300)

Benim ekran benim için 398.4843356 mm piksel eşit genişliğinde 1920 piksel olup olmadığını Yani 0,20754392479166666666666666666667 mm

So now you can calculate, if I switch down my resolution to 1280 x 768 pixel, the equation becomes: x^2 + (768/1280*x)^2 = 457.2^2 mm^2 x resolves to x=392.0457656 (according to Casio Classpad 300) and thus 1280 pixels correspond to 392.0457656 mm, which makes 1 pixel equal to 0.3062857544 mm.

This is why everything gets bigger (relative to each other) if you switch down the resolution. Measurements are in pixel, but actual size is in mm.

So you see, same screen, but different outcome, but each one is correct. SO you see, pixel = relative to resolution, but not to mm.

Imports Microsoft.VisualBasic



Namespace Units

Public Class UnitConversion

    Public Shared Function mm2Points(ByRef dSomeMillimeters As Double) As System.Web.UI.WebControls.Unit
        ' Point ist eine Maßeinheit, die 1/72 Zoll entspricht.
        ' 1 Zoll = 1 in = 1000 Thou = 1000 mil = 1/12 ft = 1/36 yd = 25,4 mm = 2,54 cm = 0,254 dm = 0,0254 m.
        ' 1 Point = 0.35277777777777777777777777777778 mm
        ' --> 1mm = 2.834645669291338582677165354337 Point

        Return System.Web.UI.WebControls.Unit.Point(dSomeMillimeters * 2.8346456692913384) 'Point
    End Function


    Public Shared Function mm2Pica(ByRef dSomeMillimeters As Double) As System.Web.UI.WebControls.Unit
        'Pica ist eine Maßeinheit, die 12 Points entspricht.
        ' The contemporary computer pica is 1/72nd of the Anglo-Saxon compromise foot of 1959, i.e. 4.23_3mm or 0.166in. Not
        ' 1 Pica = 4.233333333333333333333333333333333 mm
        ' --> 1 mm = 0.23622047244094488188976377952758 Pica
        Return dSomeMillimeters * 0.23622047244094488
    End Function


    Public Shared Function cm2Points(ByRef dSomeCentiMeters As Double) As System.Web.UI.WebControls.Unit
        Return mm2Points(dSomeCentiMeters * 10.0)
    End Function


    Public Shared Function cm2Pica(ByRef dSomeCentiMeters As Double) As System.Web.UI.WebControls.Unit
        Return mm2Pica(dSomeCentiMeters * 10.0)
    End Function

End Class

End Namespace