Closed pr-apes closed 2 years ago
There is only one (either horizontal or vertical) clipping. clip="no" means (when width and height are given) distortion, with clip="yes" there is no distortion, but the image is scaled so that the whole area (width and height) is filled with portions of the image.
Just to confirm (I barely understand this), would both clippings achievable with transformations such as the ones you describe in https://github.com/speedata/publisher/discussions/395#discussioncomment-3106364?
Just to confirm (I barely understand this), would both clippings achievable with transformations such as the ones you describe in #395 (comment)?
Yes, but this is probably tedious calculation (works with DTP points and scale calculations).
I wonder whether it would be possible to implement custom clipping with clipping="both"
and origin-x
and origin-y
(with units as in width
and height
)
I originally intended to translate a rather simple ConTeXt command:
\clip[hoffset=62.5mm, voffset=0.5mm, width=87.5mm, height=54mm]
But I ignore how hard would be to implement such feature in Publisher.
I close the issue for now (not a requirement until just before production).
I'll re-open it because I am thinking of adding a few attributes to the transform command to make it easier to use (I know that the transformation matrix is hard to use).
I think I'll add a new command Clip
to be used something like this:
<Clip left="3mm" right="2mm" top="5mm" bottom="3mm">
<Image width="5cm" file="_sampleb.pdf" />
</Clip>
to clip any kind of contents. Do you think this interface (left/right/top/bottom) is suitable or do you prefer something like the ConTeXt hoffset/voffset/width/height)?
@pgundlach,
many thanks for this element.
The ConTeXt values are more familiar to me. But this should not be a reason to decide.
Your approach is clearer (once I got what it meant đŸ˜…), but also requires to do the math,
I wonder whether having left
, right
, top
, bottom
and also width
and height
is an option.
I think it really makes sense, but I may be missing something.
Many thanks for your excellent work.
Many thanks for the new implementation, @pgundlach.
It is part of version 4.11.3 (available for download now)
I had already downloaded it (although I am testing other things).
I really appreciate this huge step in ease of use for image clipping.
Many thanks again.
@pgundlach,
with the following sample image (the cow from the ConTeXt distribution), I invoke
sp --dummy --autoopen -v external_pdfdoc=cow.pdf
with the followinglayout.xml
contents:I can get horizontal or vertical clipping, but both seems to be impossible (with version 4.11.1).
Am I doing something wrong or missing something?
Many thanks for your help.