Skip to content

feat: add --quality presets and --dpi flag for png output - #28

Open
RilusMahmud wants to merge 1 commit into
originalankur:mainfrom
RilusMahmud:feat/add-quality-option
Open

RilusMahmud wants to merge 1 commit into
originalankur:mainfrom
RilusMahmud:feat/add-quality-option

Conversation

@RilusMahmud

@RilusMahmud RilusMahmud commented Jan 18, 2026 •

Copy link
Copy Markdown

Rebuilt on current `main` (the original figsize-based presets conflicted with the later `--width`/`--height` flags and their 20-inch cap).

Adds DPI-only quality control that layers on `--width`/`--height`:

  • `--quality` / `-q`: `low` (150), `standard` (300, default), `high` (400), `ultra` (600)
  • `--dpi N`: explicit DPI; mutually exclusive with `--quality`
  • Prints the effective output size (`inches @ DPI (~px)`) after the width/height clamp
  • DPI is applied to png only, matching existing svg/pdf handling
  • README flag table updated; cases added to `test/all_variations.sh`

Addresses review comments: `low` preset for quick test renders (@Nudin), presets no longer exceed the dimension cap and `--dpi` is available for granular control with `-W`/`-H` (@necromeo).

Verified: flake8 + mypy clean (same invocation as `pr-checks.yml`); real renders checked with `sips`: `-q low` at 12x16 in -> ~1800x2400 px, `--dpi 600 -W 22` clamps to 20 in -> ~12000 px wide, `-q ultra -f svg` renders without applying DPI.

@originalankur

Copy link
Copy Markdown
Owner

Thanks for raising this, will review @RilusMahmud

@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@Nudin

Nudin commented Feb 8, 2026

Copy link
Copy Markdown

I think there should also be an option 'low' – especially for testing/trying out/debugging having a quicker version would help

@necromeo

necromeo commented Apr 5, 2026

Copy link
Copy Markdown

Feels like the max dimension constraints, when using the width and length flags, could be updated as well since some of the presets surpass their limits

# Enforce maximum dimensions

It'd be nice to have an extra --dpi flag that could be used with the --width and --length flags for more granular control. Wdyt?

Replace the figsize-based quality presets with DPI-only presets that
layer on the existing --width/--height flags, so presets no longer
exceed the 20-inch dimension cap. Adds a low (150 DPI) preset for quick
test renders and an explicit --dpi override; the two are mutually
exclusive. DPI is only applied to png, matching upstream's svg/pdf
handling.

Documents the flags in the README and adds cases to
test/all_variations.sh.
@github-actions

Copy link
Copy Markdown

Conflicts have been resolved.

@RilusMahmud RilusMahmud changed the title Feat/add quality option feat: add --quality presets and --dpi flag for png output Sep 15, 2026
@RilusMahmud

Copy link
Copy Markdown
Author

Rebased and reworked on current main. Presets are now DPI-only and layer on --width/--height, so they stay inside the 20-inch cap. Added low (150 DPI) for quick test renders per @Nudin, and an explicit --dpi flag usable with -W/-H per @necromeo. Conflicts resolved; README and test/all_variations.sh updated. Verified: flake8 + mypy clean, three real renders checked for pixel output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants