All Questions
42 questions
0
votes
1
answer
63
views
Dropdown Menu For Images P5js
I am trying to make a drop down menu in p5js that displays images. I keep running into an error with loading images. When I attempted to troubleshoot and loaded an image in another sketch I did not ...
0
votes
0
answers
59
views
p5js stretching image by four corners
Using the p5js javascript library, is there any way that I can take four points in 2D space and stretch the image's corners to fit those points? I can not use the texture function because it requires ...
0
votes
1
answer
62
views
display(){} Method p5.js not displaying image
I working on a school project. I created a class for an image. It seemed to be working when the class was embedded in the draw function. My professor said that I should move the class outside of the ...
0
votes
1
answer
89
views
Mouse Hovering/Mouse Clicked over image p5.js
I am trying to create the experience of playing a hand drum. The idea is that the user picks up the drum mallet, hovers it above the drum, and if the user clicks again the drum plays the audio. Is ...
1
vote
1
answer
23
views
Call out function when images collide
PD: I'M PRETTY NEW AT THIS SO I'M ONLY DOING THE BASICS
I have no idea on how to call out a function when two of my images collide. Here's my code:
var arbol;
var poma;
var pomaicono;
var cistell;
var ...
1
vote
1
answer
166
views
How do I load pixels from uploaded image file in p5js?
The image is created from a file input. With this input it is then loaded to make sure the image exists before loading pixels. Either way, both using the successful callback in loadimage and without a ...
0
votes
1
answer
460
views
Mapping an image to a quadrilateral in p5.js without using WEBGL
I'm trying to map a custom image to a 4-sided quad with a non-rectangular shape in p5.js. I know this is possible(and quite easy) using a WEBGL canvas and the texture() command, but I'm trying not to ...
0
votes
0
answers
401
views
p5.js loadImage and image to set a background image
SOLVED
I was missing script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js"> in index.html
I am using JavaScript and the p5.js library in VSC and trying to get an image ...
1
vote
0
answers
46
views
I can't seem to be able to make a hittable image (tries to make image a function)
so I have been trying to make an aim trainer with javascript p5, but when I try to load in an image as an randomly shootable target it doesnt seem to let me click the image. I dont really understand ...
1
vote
1
answer
393
views
get() function returns an empty pixels array in p5.js
The thing that i wanna do is similiar with this video. In p5.js, I am using get() function. After use this, I will create small images (by dividing big tileset) and push them into an array. But in my ...
1
vote
1
answer
783
views
How can I make the background transparent in P5.js, but still keep the same effect?
I have a P5.js art, but when I remove the background, the effect changes. I'd like to remove the background but keep the effect the same. The reason for this is because I plan to overlay this on top ...
0
votes
1
answer
659
views
p5.js | Can you manipulate the pixels of a camera capture in real-time?
In the code below I'm trying to paint red every other pixel, coming from the camera capture
let capture
function setup() {
createCanvas(320, 240);
capture = createCapture(VIDEO);
}
function draw(...
1
vote
2
answers
817
views
Draw an image from an array value p5.js
I am fairly new to p5.js, however I am trying to read a .txt file which contains the below text, and draw a picture depending on the value within the .txt file.
00000
20022
00222
22020
11111
I am ...
0
votes
1
answer
342
views
(valid reason) Loading image outside Preload (p5js)
I want to know if there was a way to make sure an image was loaded when loading it outside Preload. I sometimes get “Uncaught ReferenceError: loadImage is not defined” and sometimes it loads. It ...
0
votes
1
answer
783
views
Create a image-mask with p5js
Im trying to figure out if its possible to have a blank canvas and then place a image and have it masked by a random shape? That or use a png as mask.
Thank you
M
0
votes
1
answer
925
views
Dragging images with mouse, conditionals being ignored in p5.js mouseDragged() function
New to javascript. I am trying to use p5.js to allow users the ability to move images on screen when they click on the image and drag their mouse. I have loaded in an image called cart1, with an ...
1
vote
1
answer
2k
views
In p5.js, is it possible to load a gif in the setup or preload function, and then use that gif multiple times elsewhere?
I have a class (lets call it "Enemies"), I want them to attack me when close enough (It will display an animated gif, that looks like a bite).
I've gotten all of this to work, except the ...
-1
votes
2
answers
213
views
Extreme Novice needing assistance with mousePressed() event
I am VERY new to P5.js/processing (taking programming for artists). I am trying to make a crude game where an image (Jar Jar) bounces across the screen and another image (lightsaber) that moves with ...
1
vote
1
answer
858
views
Need to upload user's image input - P5 JavaScript library
I have a Sketch in Processing written in P5.js, but I don't know how to implement user's input.
The program needs to get .jpg image and it's working on it.
Every my attempt of user-input ...
0
votes
1
answer
1k
views
how to loadImage and draw the image without an error
im trying to load an image with p5.js loadImage(image);.
Im using the p5 library on my desktop.
Im not using the browser editor when im using the browser editor it handles the loading just fine
but im ...
1
vote
1
answer
575
views
Image Circle Distortion in Processing / p5js
I am trying to implement a circle distortion function in Processing / p5js. Here are two examples of what I want to achieve:
https://www.shadertoy.com/view/MsSSDz and
http://jsfiddle.net/hto1s6fy
Both ...
1
vote
1
answer
903
views
p5js: sending still images through HTTP POST
I'm using a simple p5.js programme to take a webcam stream and show a still image from this on the screen every few seconds.
let capture;
function setup() {
createCanvas(320, 240);
capture = ...
1
vote
1
answer
316
views
p5.js array of images and data retrieve with splice
I have an array of images and I want to use splice to retrieve an image from it.
But when I store the data and use it as the image argument in the image() function, I get an error:
image() was ...
2
votes
3
answers
2k
views
I tried to save 27 images in p5.js but only 10 is saved into my downloads folder. Why are all the files not saved?
In my code I try to save 27 images into my downloads folder but when i run the code it only saves a maximum of 10 images into my downloads folder. I logged my results in the console and the code seems ...
0
votes
4
answers
8k
views
image won't load in p5.js
I am trying to upload a image to one of my p5 files.
I tried it the way it is described in the p5 reference, but that does not work.
Then I tried to write the image in a separate function and run that ...
-3
votes
1
answer
843
views
How to set the background of an ellipse in javascript to an image?
I'm using javascript with the p5 library and currently I only know how to use the fill() function to fill an ellipse with a color. Is there a way to set the ellipse's background to an image?
0
votes
0
answers
959
views
How to save image to specific directory in p5.js
I wanna save image to "../assets/" in in p5.js
I tried this
save("../assets/", "test.png")
but don't work.
How can I solve this?
2
votes
1
answer
928
views
p5.js image histogram equalization
It's easy to blend() two images using p5.js, which is great, but I would like to be able to equalize the histogram of the resulting blended image. Something like -equalize in ImageMagick. Does anyone ...
0
votes
1
answer
52
views
How to compare an array of object generate automatically to avoid double in it?
I'm making an art project. In it I display images when a key is pressed. Like if you press "a" it display an image of a abstract "a". The problem is that I want to manipulate those image once they are ...
0
votes
1
answer
2k
views
TypeError: Cannot read property 'width' of undefined when using image() in p5.js
So I'm trying to show an image that I have loaded with loadImage(), but when i get to using the image() function I get
TypeError: Cannot read property 'width' of undefined
Here is the code:
let ...
5
votes
2
answers
6k
views
How do I save a p5.js canvas as a very large PNG?
I know how to save the canvas using p5.js. However I want to save the canvas as a very large png (for example 8000x8000) so that I can use it in Photoshop and scale down the image to the appropriate ...
1
vote
1
answer
55
views
Loading images uploaded with a form not showing
The user uploads images with a form. The images should all be displayed in the canvas. Only one of multiple images shows. Maybe the images are not properly loaded?
html:
let value = 0;
var ...
2
votes
1
answer
2k
views
How can I crop an image in p5.js without drawing image on the screen
I've researched and found that you can "crop" an image by using get(), but the image has to be drawn on the screen where you then take a section of the canvas. Is it possible to load an image then ...
0
votes
0
answers
545
views
Trying to make an image disappear after clicking it p5
So I have very beginner knowledge with code, and am trying to make a 'forest' scene where the user can click on 5 little blobs of slime mould, and once they click on them they disappear.
Right now ...
0
votes
2
answers
2k
views
Get pixel brightness with p5.js
I'm trying to get the pixel data from an image to calculate the image's average brightness. I have no problem accessing the data with img.loadPixels(); but for some reason some elements of the pixel ...
1
vote
1
answer
721
views
Revealing an image (p5.js)
I'm trying to make something where an image is gradually revealed by the path of a spiral. I've gotten to the point where I can make it have the colors of the image I'm using, I can get it to spiral, ...
0
votes
1
answer
29
views
Advice on Shortening My p5.js Code (for loop?)
I'm making a program that will randomize and load 6 different images next to each other each time the mouss is clicked.
function mousePressed() {
randomNum1 = floor(random(0,6));
randomNum2 = ...
1
vote
1
answer
98
views
Shouldn't this code make the whole picture black?
In p5.js, I am trying to process each pixel of an image for a personal project so I thought I would start out slow and just try to make each pixel black. For some reason the screen is just staying ...
0
votes
1
answer
1k
views
change game screen & changing character image using p5.js
I am creating a simple computer game. The concept is that there are random birds on the screen, and when the mouse is pressed, the birds stop and change to a dead bird image. I need help with ...
0
votes
0
answers
128
views
My sprites in p5.play continue to have a strange halo surrounding them
Does anyone know why all of my sprites (images) have strange halos drawn around them whenever I run my sketch? Am I using the wrong filetype or transparency settings?
0
votes
1
answer
2k
views
Change Image when mouse rollsover
Im coding in P5. I have two images on my page. Im trying to code it to the affect that when the mouse is to the left of the image it changes to the other image. This is the specific: next we will ...
3
votes
1
answer
3k
views
How to crop an image in P5?
I am working on a program in P5, an offshoot of Processing, that allows the user to upload an image, draw a line on top of the image, and then crop everything outside of the drawn shape out of the ...