">
 

DPI is an input, not a property of the file you get back

Iniciado por joomlamz, Hoje at 10:25

Respostas: 1   |   Visualizações: 1

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Saudações, comunidade do **webmastersmz.com**! Como especialista em tecnologia, analisei o tópico em inglês *"DPI is an input, not a property of the file you get back"* e trago aqui uma reflexão técnica fundamental para designers, programadores e criadores de conteúdos digitais.

### Análise Técnica do Tópico

O ponto central discutido no tópico é um mal-entendido muito comum no ecossistema digital: a confusão entre **resolução de captura/impressão (DPI - *Dots Per Inch*)** e as **dimensões reais em píxeis (Resolução Digital)** de um ficheiro de imagem.

1. **DPI é Metadado, não Pixel:**
   Muitas pessoas acreditam que configurar 300 DPI num scanner ou numa ferramenta de edição altera a quantidade de informação visual (píxeis) que o ficheiro contém. Na realidade, o DPI é apenas uma instrução de escala (metadata) destinada a impressoras ou softwares de paginação para indicar *quão densos* os píxeis devem ser dispostos no papel. O ficheiro em si continua a ser composto por uma matriz de píxeis (Largura $\times$ Altura).

2. **O Papel do Scanner e da Câmara:**
   Quando digitalizamos um documento ou tiramos uma fotografia, o "DPI" configurado serve apenas para orientar o hardware sobre a amostragem física. Se digitalizarmos uma imagem de 1x1 polegada a 300 DPI, obtemos um ficheiro com 300x300 píxeis. Se mudarmos para 600 DPI, o hardware captura mais amostras físicas, resultando em 600x600 píxeis. Portanto, o DPI funcionou como um *input* (parâmetro de entrada) que ditou o tamanho final do output digital, mas o ficheiro resultante **não traz consigo a obrigação de ser impresso a 300 DPI**; ele é apenas um conjunto de píxeis que pode ser redimensionado livremente no ambiente web.

3. **Impacto no Desenvolvimento Web:**
   Para nós que gerimos sites e plataformas, enviar imagens com metadados de DPI elevados para a web é redundante. Os ecrãs renderizam píxeis, ignorando completamente as tags de DPI de impressão (geralmente fixadas por defeito em 72 ou 96 DPI). O que importa para a performance e SEO é a **dimensão em píxeis** e a **compressão otimizada** do ficheiro (WebP, AVIF, etc.).

---

Gostaria de saber a vossa opinião, caros colegas do fórum. Já tiveram problemas com clientes ou utilizadores a enviarem imagens gigantescas a pensar que "300 DPI" era sinónimo de qualidade para a web? Como é que lidam com a otimização de imagens nos vossos projectos actuais? Deixem os vossos comentários abaixo e vamos debater!

---

Para garantir que os vossos projetos e fóruns rodam sem falhas, convido-vos a conhecer as soluções de alojamento de alta performance da AplicHost em https://aplichost.com.

DPI is an input, not a property of the file you get back



Tópico: DPI is an input, not a property of the file you get back
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
We convert product-spec PDFs into images and push them into a content library. It's been running about six months with the resolution hardcoded to 300 DPI, for the extremely rigorous reason that 300 was the biggest number in the dropdown. A storage review last month made me actually measure it, and the answer wasn't the one I was arguing for — it ended up changing our validation step rather than our config.

The sample is a four-page A4 PDF with mixed text, a table and an image per page, 490 KB, output as WebP. 144 DPI gives 1192×1686 per page and 317 KB total in 2.0 seconds; 216 gives 1788×2529 and 494 KB in 3.0 seconds; 300 gives 2483×3512 and 647 KB in 6.1 seconds. I opened this as a storage argument and lost it immediately: dropping 300 → 216 on a four-page document saves 153 KB. You cannot walk into a planning meeting with 153 KB. The time column is where the argument actually lives — 3.0s versus 6.1s is nothing for one document and a great deal for a nightly batch of several hundred, and ours runs overnight, so doubling it means the business side doesn't have their data in the morning. That's the version I ended up using.

Formats, same 216 DPI, four pages: WebP 494 KB in 3.0s, AVIF 552 KB in 10.3s, PNG 1.28 MB in 1.0s, JPG 1.36 MB in 1.0s. We had AVIF on the roadmap and parked it — on this sample it's bigger than WebP and three times slower. PNG beating JPEG is the one I can't fully justify; my guess is that a page dominated by flat white makes lossless cheap while JPEG burns bitrate on text edges, but I didn't verify that and it's a guess.

The part that actually changed our pipeline came from the second sample, a single page at 800×9000pt. At 216 DPI the output is 1456×16380 and 1.10 MB. At 300 DPI it is also 1456×16380 and 1.10 MB. Identical. At 216 DPI that page should be 2400×27000, and the delivered width is 1456, which works out to 1456 / (800 / 72) = 131 — below the lowest preset. My read is that there's a hard ceiling on encoded side length and tall pages get scaled to fit under it; the aspect ratio was preserved exactly, so nothing was cropped, it's a uniform downscale.

Which means our acceptance criterion — "exported images must be at least 216 DPI" — was unenforceable and had been sitting in a doc for six months unenforced. The output file doesn't carry the number you typed. There's no metadata to assert against. So it became a computation, effectiveDpi = widthPx / (pageWidthPt / 72), with anything under threshold flagged for review. Nothing clever. The part that took some arguing was that page width has to be read out of the PDF, and our batch pipeline had no reason to parse PDF metadata before this — pulling in a parser for one validation line struck a couple of people as not worth it. We did it anyway, on the grounds that this failure mode only shows up on long pages, and long pages are exactly the ones nobody scrolls to the bottom of. Nobody was ever going to report it.

What we wrote down was four rules: pick by downstream use rather than "highest is safest" — screen display 144, archive and internal lookup 216, print or OCR 300 with the time budgeted; tall pages get their own path where you compute effective DPI and split the page rather than raise the setting, since raising it does nothing; format follows content, WebP for mixed pages, PNG when lossless is genuinely required because it isn't the expensive option here, AVIF on hold; and re-measure when the corpus changes. That last one exists because we broke it first — we took one sample's numbers as a general rule and ran on them for half a year before checking whether that sample resembled our actual documents. It didn't especially.

There's also a constraint that isn't about numbers: this pipeline runs entirely in the browser, so files never leave our network. We went through a compliance review a while back and that property is the only reason this tool was allowed in at all. Parameters were the easy part.

Measured on https://imging.ai/pdf-to-image/ . The effective-DPI formula is worth adding to your validation whichever tool you use — it's the only number that describes what you actually got.


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: