Chrome crashing due to toDataURL

Recently, I have been working on a Tile Renderer for three.js and so far, everything appears to be functioning correctly.

The process is quite simple:

a) It creates multiple cameras, b) Renders the scene using each camera c) Generates a 'toDataURL' and downloads it.

Here is a snippet of the code:

  this.renderer.render( this.scene , this.camera );

  var imgData = this.renderer.domElement.toDataURL();      

  //this.imageData.push( imgData );

  var a = document.createElement('a');

  a.href = imgData;

  a.download = this.title + "_"+this.x+"_"+this.y+".png";
  a.click();

However, when this process is repeated numerous times, it ends up producing an excessive amount of images. This causes my Chrome tab to crash without fail. Is there any way to prevent or mitigate this issue? Perhaps by adjusting certain settings in Chrome or modifying the code itself. I have attempted adding timeouts for each render call (such as pausing the renderer, rendering one image, and saving it every 10 seconds), but even this method does not seem to resolve the problem.

If you are curious to witness the crash, feel free to visit the following link: (simply press 'p' to attempt capturing the images; note that the page may take a moment to load).

Thank you in advance for any assistance!

Sincerely, Isaac / Cabbibo

Answer №1

When I try to save large images as PNGs on my computer, it causes Chrome (OS X 10.10, Chrome 40) to crash. However, saving the image as a JPG solves this problem. It seems like the PNG data string may be too big.

var imgData = renderer.domElement.toDataURL("image/jpeg");  

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I am experiencing an issue where my Laravel website does not refresh automatically

Having trouble with the URL (url: "/ultimo-pedidox"). It seems to be loading correctly, but the view isn't refreshing as expected. @extends('store/template') @section('content') <div style="margin-top: 55px;" ...

Exploring through a table using JavaScript

I am struggling to search a table within my HTML for a specific term. The code I have works to an extent, but it does not account for alternatives such as searching for "what is that" when I type in "What is that". Additionally, I need the script to ignor ...

Blur images on parent div when hovering using javascript

After some extensive searching, I came across a few helpful explanations on how to achieve my desired outcome. By combining them, I was able to get everything working smoothly with the hover effect over the image itself. However, when I attempted to trigge ...

Creating an array inside a Vue function

Currently, I am facing a challenge with restructuring an array in Vue.js. I am able to log the values within my method and push them into an array, but I'm struggling to format the array as required. The desired structure of the array should be like ...

CSS3 Animation: Facing issue with forwards fill behavior in Safari when using position and display properties

After creating a CSS3 animation to fade out an element by adjusting its opacity from 1 to 0 and changing the position to absolute and display to none in the last frames, I encountered an issue. In Safari, only the opacity is maintained while the position a ...

Can we stub these types of functions in any manner?

One file named helperFunction.js contains the following code: module.exports = (arg1, arg2) => { \\function body } To use this function in another file named file.js, you can simply call it like this: let helperFunction = require(' ...

Guide on importing a Vue 3 component dynamically

As mentioned in this informative article, I am looking to dynamically import a component to view in my Vue 3 application. Here is the snippet of code from the view: <template> <div class="page"> <latest-box v-if="showL ...

I'm stumped trying to understand why I keep getting this syntax error. Any thoughts on how to fix it?

Our team is currently working on creating a dynamic SELECT box with autocomplete functionality, inspired by the Standard Select found at this link: We encountered an issue where the SELECT box was not populating as expected. After further investigation, ...

Angular JS Visibility Toggling with Ng-Show and Ng-Hide

Working on an angular service for a login form, I've successfully implemented authentication using a factory with an http injector to handle HTTP credentials. However, I'm facing an issue in displaying an error message when incorrect credentials ...

Puppeteer does not display the TikTok comment input, whereas it is visible on the browser

Why can't I see the TikTok comment input on Puppeteer, but it's visible in the browser? Browser screenshot Puppeteer screenshot I've tried zooming out and adjusting the viewport with no success. I've written the code, but can't ...

React app version displaying incorrect links to CSS and JS files

I have been immersed in a React project called Simple-portfolio, you can find the GitHub repository here: https://github.com/Devang47/simple-portfolio and the live site at this URL: While everything works smoothly on the development server, I encountered ...

What could be causing my NextAuthJS discord login to function in the test environment but fail to deploy in production on NextJS 13?

After attempting to deploy my NextJS application on Vercel, I encountered a problem with the AuthJS sign-in model. While running the program using npm run dev, everything works smoothly and I can log in to my Discord account linked to the developer portal& ...

Step-by-step guide on building a mat-table with nested attributes as individual rows

Here is the data structure I am working with: const families = [ { name: "Alice", children: [ { name: "Sophia" }, { name: "Liam" ...

Video player for Angular 2

Hey there! I am currently exploring Angular 2 and attempting to create a video playlist feature. My goal is to showcase my favorite videos in a table layout, where clicking on a row will lead to the playback of the selected video. Right now, I am passing t ...

Sliding off the canvas - concealed navigation

I have implemented CSS to hide a menu on mobile: #filter-column { position:absolute; left:-400px; } However, I want the menu to slide in from the left when the user clicks a link, and everything else should be hidden. When the layer is closed, th ...

How to display two elements side by side within a div using React

I have an array that looks like this: const arr = [1,2,3,4,5,6,7,8,9,10] I am looking to display the elements in pairs per line within two-dimensional divs. Here is what I have in mind: This represents the main React element: render() { return <di ...

React table row render error

I am facing an issue with my React code: var PostRow = React.createClass({ render: function(){ var loading = <tr><td>one row</td></tr>; return( {loading} ) } }); An error message is bein ...

I can't figure out why my SCSS isn't loading, even though I've added it to the webpack.mix.js file in my Laravel project that's set up with React.js

I'm facing a problem where my SCSS is not loading in the VideoBackground.js component of my Laravel project built with React.js, even though I have set it up correctly in the webpack.mix.js file. The file path for the videoBackground.scss file within ...

Access the child scope's attribute within the parent scope in AngularJS

angular.module('myApp',[]) .controller('Parent',['$scope',function($scope){ //no specific definition }]).controller('Child',['$scope',function($scope){ $scope.user={name:''}; //create a us ...

Performing a cross-domain JSON Get request with JQuery

Struggling with a simple JSON get request to an API on a domain that I don't have control over. Here's the code I'm using: $(document).ready(function () { $.ajax({ type: 'GET', url: 'http://pu ...