question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression in blit function when srcx is non-zero

See original GitHub issue

Expected Behavior

The blit function takes optional arguments srcx, srcy, srcw, srch to specify a region of the source image to blit. For example, if the source image is a 100w x 100h square and the destination is a 50w x 100h rectangle, it should be possible to blit the left half of the source image into the destination with dest.blit(src, 0, 0, 0, 0, 50, 100), or the right half with dest.blit(src, 0, 0, 50, 0, 50, 100).

This worked as expected in Jimp 0.2.28, but it no longer works in Jimp 0.4.0 (I haven’t tested any other versions).

Current Behavior

Blitting the left half of the source image (with srcx = 0) works as expected, but blitting the right half (with srcx > 0) doesn’t affect the desination image at all. The problem seems to involve the following check at line 68 of plugin-blit/dist/index.js:

if (x + sx >= 0 && y + sy >= 0 && maxw - x - sx > 0 && maxh - y - sy > 0)

This check causes all pixels to be skipped when blitting the right half of the source image. I’m not sure whether the problem is the check itself, or the values of sx and sy that are being passed to the scanQuiet() callback.

Context

  • Jimp Version: 0.4.0 (bug does not exist in 0.2.28)
  • Operating System: Linux
  • Node version: 10.7.0

Thank you for this fantastic project!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

2reactions
hipstersmoothiecommented, Sep 15, 2018

@t3rminus that was super useful! I basically added your code as test cases. The cat example made me laugh. I’ve opened #613. Once merged I’ll put a release together.

0reactions
hipstersmoothiecommented, Sep 15, 2018

Seems to be working now https://jsfiddle.net/n7rd8by3/ 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to force zero interception for fitting a 2nd order function ...
It means regress the square of y on x, omitting the intercept. Once the coefficient of x has been estimated division by pi...
Read more >
WebGL glBlitFramebuffer failing on Mac Chrome only when ...
and glBlitFramebuffer function does not copy buffers ... adjust src/dst region if blitting pixels outside framebuffer on Mac: 644740
Read more >
Use Scatter Plots to Identify a Linear Relationship in Simple ...
A scatter plot is a special type of graph designed to show the relationship between two variables. With regression analysis, you can use...
Read more >
59499 – SIGSEGV src/mesa/swrast/s_blit.c:546
Bug 59499 - SIGSEGV src/mesa/swrast/s_blit.c:546 ... Keywords: regression ... bin/fbo-srgb-blit -auto Mesa warning: failed to remap index 167 Mesa warning: ...
Read more >
What's New - PyGame
[HG 3411:7b227f4892f2] Apr 23, 2015 Reindent alphablit.c [HG ... Consequently, the base module exports several new Pygame C api functions and a new ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found