Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Hey I wonder where can I find a tool to edit image online. I want to create a tool that I give some text & an image which will write it(the text) on a specific place in the image, and allow for saving or exporting the result as jpg or png.
The accepted answer for Put text on an image and save as image explains how to do this:
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
var imageObj = new Image();
imageObj.onload = function(){
context.drawImage(imageObj, 10, 10);
context.font = "20px Calibri";
context.fillText("My TEXT!", 50, 200);
// open the image in a new browser tab
// the user can right-click and save that image
var win=window.open();
win.document.write("<img src='"+canvas.toDataURL()+"'/>");
};
imageObj.src = "mail-image.jpg";
};
You can learn more about canvas here
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 22 days ago.
Improve this question
I have a REST API return a Base64-encoded image:
API response
Is there a way to get dimensions (height, width) of this image?
You can create an Image object with the given src and directly access the width and height properties.
let url = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAABp0lEQVR4nO2YzarqMBRG08bUaicRFIWCmSgUnPj+z+BUEQQrxYBQrdCiVMnPGfTCvehtztmj42CvUUv297GSQAf1VqsV+Tz83xb4P6gFAbUgoBYE1IKAWhBQCwJqQUAtCKgFAbUgfKhWx7283W7ruiaEhGGYJImU8nK5dLtdIUQYht+2v8QJIT9scGlZaz3PWy6XzWtVVff7fbFYVFV1PB5ns5nb6SUOanBd4uPxMMas1+vNZlOW5e12GwwGlFLO+fP5tNY2Y+fzOU1TQsjhcMjzvC1OCGlrgGnVdc0YS5JECJFlmda60/lzur7vG2Oa5+FwaK3d7/fGmNFo1Ba31rY1vOO6RM4555wQEkURY4xSqrVulrTWvv93S+PxeLfbzedzR1wp5Wh4wXVaeZ6naaqUqqrKGBNFUVEUSqnr9RoEged5zZi1VkoZx7GU8t97eYkzxtoa3vEcv0aMMVmWlWUZBMF0Ou33+1LKoigYY0KIXq/XjEkpKaWTyeR0Ommt4zhuizfD7w0wrV/kQz+nqAUBtSCgFgTUgoBaEFALAmpBQC0IqAXhCy1TEI1gV/YFAAAAAElFTkSuQmCC';
// same image as https://via.placeholder.com/50x50
let img = new Image();
img.src = url;
img.onload = function() {
console.log(img.width, img.height);
}
document.body.append(img); // just for demonstration
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a few thousand JPEGs of different animals. I want to show them moving from the left end of the screen to the right in a web browser. At any point of time there may be a few animals or a few hundred on the screen. How can I do this in Javascript?
You can for example use an already animated looped gif of an animal walking. Then you can just change the position of the gif with JS.
var elem = document.getElementById("animal");
var pos = 0;
var id = setInterval(frame, 75);
function frame() {
if (pos >= 100) {
pos = -10;
} else {
pos=pos+0.25;
elem.style.left = pos + '%';
}
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm trying to investigate how this effect is made in http://work.co/grid/. Is there any plugin in jquery to implement similar effect.
Can anyone help me with this as I don't know even what the effect is called but I want to know how it is done.
As per my understanding I think you need this type of example
http://jsfiddle.net/kevalbhatt18/tgsf8n69/1/
hear I will zoom div when you click on div
var isFullscreen = false;
$('.zoom').click(function() {
var d = {};
var speed = 900;
if(!isFullscreen){ // MAXIMIZATION
d.width = "100%";
d.height = "100%";
isFullscreen = true;
}
else{ // MINIMIZATION
d.width = "300px";
d.height = "100px";
isFullscreen = false;
}
$(".zoom").animate(d,speed);
});
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
need to let the images disappear and reappear like here (footer at) http://www.guiltypeople.nl/het-bureau/.
Each logo, disappear slowly, and reappear on a different place. Could you help me find a Javascript plugin or something to do this?
thanks
First: To overlap the images you must make a trick with position: absolute or play a bit with background. Check here, here and here.
TIP: If the position it's random and not a loop, you must implement a function which changes location of background hidden object's with jquery or javascript.
Second: When you have the images overlapped, you must make the transition effect. For this you must use a loop and the alpha css property.
In your original question you asked also for rotations and other FX, for this you don't need a plugin, check transforming with css.
Example of changin alpha property in plain javascript:
for (var i = 0; i <= 100;){
var element = document.getElementById('id');
element.style.opacity = i * 0.1;
element.style.filter = 'alpha(opacity=' + i + ')'; // IE fallback
i = i + 10;
}
You can use the iterations to make rotation also, or use less i increment to perform each action when mod condition is true, imagine you want to rotate 90 degrees 4 times and make image disapear in 10 steps:
i = i + 5; // allows 20 iterations
if (i % 25 == 0) // if you want 4 rotation steps
if (i % 10 == 0) // if you want 10 alpha modifications
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
How can I use PhotoShop's JavaScript functionality to convert a set of hundreds of images to a specific, non-square size (e.g. 320x350px)?
Searching the web I've found many potential solutions but 100% of them converted to square sizes. So, I gathered a few and solved the problem myself.
Save the code below as a .jsx file in your Photoshop \Presets\Scripts folder. Then, make an ACTION if want to use it with many files.
// get a reference to the current (active) document and store it in a variable named "doc"
doc = app.activeDocument;
// change the color mode to RGB. Important for resizing GIFs with indexed colors, to get better results
doc.changeMode(ChangeMode.RGB);
// these are our values for the END RESULT width and height (in pixels) of our image
var fWidth = 320;
var fHeight = 350;
// do the resizing. if height > width (portrait-mode) resize based on height. otherwise, resize based on width
if (doc.height > doc.width) {
doc.resizeImage(null,UnitValue(fHeight,"px"),null,ResampleMethod.BICUBIC);
}
else {
doc.resizeImage(UnitValue(fWidth,"px"),null,null,ResampleMethod.BICUBIC);
}
// Makes the default background white
var white = new SolidColor();
white.rgb.hexValue = "FFFFFF";
app.backgroundColor = white;
// Convert the canvas size as informed above for the END RESULT
app.activeDocument.resizeCanvas(UnitValue(fWidth,"px"),UnitValue(fHeight,"px"));
// our web export options
var options = new ExportOptionsSaveForWeb();
options.quality = 70;
options.format = SaveDocumentType.JPEG;
options.optimized = true;
var newName = 'web-'+doc.name+'.jpg';
doc.exportDocument(File(doc.path+'/'+newName),ExportType.SAVEFORWEB,options);