processing / processing/p5.js

noSmooth() does nothing on images loaded via preload

Open
#5,506 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Core Area:Image Bug
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility (Web Accessibility)
  • Build tools and processes
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Friendly error system
  • Image
  • IO (Input/Output)
  • Localization
  • Math
  • Unit Testing
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)
Details about the bug:
  • p5.js version: 1.4.0
  • Web browser and version: Firefox 95 Build ID: 20211129150630
  • Operating System: Ubuntu 20.10
  • Steps to reproduce this:

Use the following code in either the web editor or the p5 example project.

function preload() {
  pixelArt = loadImage("pixelArt.png");
}

function setup() {
  
  createCanvas(400, 400);

  noSmooth();
  pixelArt.resize(150, 0);
  
}

function draw() {
  image(pixelArt, 0, 0);
}

noSmooth() does not function as intended, however upon moving the image definition from preload to setup, the image now resizes properly with no aliasing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided reproduction in the web editor, then trace the noSmooth(), loadImage(), resize(), and image() paths for images loaded during preload(). Done means the same no-aliasing behavior works when the image is loaded in preload() as when it is loaded in setup().

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.