How to control the scale factor for Firefox screenshots (duplicate)


(retif) #1

Firefox Developer Edition 62.0b13 (64-bit) on Mac OS 10.13.6 (17G65)

Is it possible to control the scale factor for screenshots? For example, I want to screenshot some node that has a width of 1080px via right-click menu:

enter image description here

The result image will be twice the size, so 2160px . But I would like to make a screenshot 1:1. Is there a setting for that? I couldn’t find it in about:config .

I saw in this answer that it should be possible in Browser Console, but when I try to do so I get ReferenceError: screenshot is not defined .

This question is a duplicate from Firefox Development.


Call Firefox helper functions from JS
(sole) #2

Hello!

When you take screenshots of a node you can’t control scale or dpi (I reckon it’s giving you 2x the size you see because you’re using a high resolution ‘retina’ device).

I’m sorry that the instructions that you found in StackOverflow are outdated. Starting in Firefox 62, to access the screenshot feature in the console you need to prepend a semicolon: :screenshot. Then you can use more specific options such as dpr and selector.

For example, you could get a screenshot of an specific element using its id, at 1x resolution (i.e. not retina/high dpi) with:

:screenshot --selector '#element-id' --dpr 1

Let me know if that works!


(retif) #3

That works just fine, exactly what I wanted, thanks a lot.


(sole) #4

Sweet! Thanks for confirming. Enjoy! :slight_smile:


(jscher2000) #5

Yes! I added a new section (“Additional Options”) here: