Images DPI

mi
mickputley
Posts: 33
Joined: Sat Dec 23, 2017 1:13 am
Platform: Mac

Sat Dec 30, 2017 11:05 pm Post

Hi, when I use File/Insert Image from file and add an image that is 1080 x 1430 (JPEG) at 300dpi. Then double click own the image to slide the size back to 1080 x 1430 Scrivener reports the dpi has been reduced to 72. I don't want that to happen. In preferences the import JPEG compression is set at the lowest (I have already optimized in photoshop to level 8 and removed color profiles and metadata, I have chosen 1080 x 1430 at 300 dpi to match the Kindle White. How do I stop Scrivener changing the dpi from 300 to 72 ?

Thanks

User avatar
gr
Posts: 1727
Joined: Wed Feb 14, 2007 3:57 am
Platform: Mac + iOS
Location: Florida

Sun Dec 31, 2017 3:52 am Post

I note that the dimensions you are adjusting in the image dialog box are specified in points, not pixels.
gr : Scrivener user : not affiliated with Lit^Lat
Image
"Nothing, like something, happens anywhere." —Philip Larkin

mi
mickputley
Posts: 33
Joined: Sat Dec 23, 2017 1:13 am
Platform: Mac

Sun Dec 31, 2017 7:56 am Post

Quite right, my error, but that was background info. I am talking about the image being converted from 300 dpi to 72 dpi or am I missing the meaning of what you are saying? Thank you for your response, I truly appreciate the attention.

M

User avatar
Bridey
Posts: 390
Joined: Wed Nov 22, 2017 2:24 pm
Platform: Mac

Sun Dec 31, 2017 8:38 am Post

This post and the ones below it *might* help...

viewtopic.php?p=244414#p244414

User avatar
nontroppo
Posts: 1067
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Sun Dec 31, 2017 12:29 pm Post

Actually DPI is not a physical "thing", it is just metadata on how to go from pixels to an preferred "real-world" size. An 800x600px image is identical whether it is at 300DPI or 72DPI, it is not changed by changing DPI. Only when it is time to estimate its size for printing is when this matters.

But Scrivener is respecting the DPI metadata, here I dragged an image I just created in Pixelmator at 300DPI into Scrivener and Scrivener has correctly picked up its DPI metadata:
Screen Shot 2017-12-31 at 20.24.23.png
Screen Shot 2017-12-31 at 20.24.23.png (68.33 KiB) Viewed 1999 times


You should check that Photoshop is correctly tagging the JPEG metadata, you can use Preview to check this...

User avatar
AmberV
Posts: 22434
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza
Contact:

Sun Dec 31, 2017 1:47 pm Post

Another way of looking at it is that an image that is 1080 points tall with a 1080 pixel tall raster will be 72 DPI on a Mac because that is the basis for the measurement of a point on a Mac (1 point = 1/72nd of an inch). That is all Scrivener is telling you, that (a) the image will be 15" tall (1080pt / 72) and to get it that tall with 1080 pixels, each pixel will need to be precisely one point tall, and since there are 72 points in an inch that means each pixel is 1/72nd of an inch tall and thus 72 DPI. :)

To change the print size of the image without changing the DPI requires subtracting or adding literal pixels from the raster—which requires interpolation (damage) to the original image. I.e. to increase the height of the image to 1080 points while retaining a 300 DPI setting on an image starting with 1080 vertical pixels, you will need to increase the amount of pixels to 3,399. For a job like that, you need to use a pixel editing program, not something that just adjusts the display of those pixels.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
gr
Posts: 1727
Joined: Wed Feb 14, 2007 3:57 am
Platform: Mac + iOS
Location: Florida

Sun Dec 31, 2017 2:36 pm Post

mickputley wrote:Quite right, my error, but that was background info. I am talking about the image being converted from 300 dpi to 72 dpi or am I missing the meaning of what you are saying?


Here is how it would matter: If you have a 1080 x 1430 pixels image and drag the slider to 1080 x 1430, you are asking Scriv to scale the image to 1080 x 1430 points. If one point size equals multiple pixels, you are effectively asking to blow up the image -- which means that your image would have to be "printed" at a lower dpi, since DPI is determined by the resolution of your image (pixel dimensions) together with the scaling (target real-world size).

You notice that the pixel dimensions of the image never change. Scriv is not downsampling your image.
gr : Scrivener user : not affiliated with Lit^Lat
Image
"Nothing, like something, happens anywhere." —Philip Larkin

mi
mickputley
Posts: 33
Joined: Sat Dec 23, 2017 1:13 am
Platform: Mac

Sun Dec 31, 2017 10:43 pm Post

OK I understand now. But here is the thing. When I drag a image that is 1080x1440 at 300 dpi into my project, I now understand that when I look at the slider it says 259x345 POINTS which since a Kindle PaperWhite is 4.16666 pixels per point calculates correctly at 4.8 inches x 3.6 inches which is spot-on. Thanks to your explanation, I get that now. So I don't touch the slider, compile for epub3 and open the ebook using the built-in ebook reader on my iMac. At the default window size the picture looks tiny, It fills about 1/4 of the book page.

However, if I open a downloaded EPub from anywhere (example Gutenburg Project) and open that using the same app and the same window size their pictures look the correct size. If I break open the EPub and examine the JPG inside using preview or Photoshop the pictures are SMALLER e.g. the in Les Miserables there is a file called @public@vhost@g@gutenberg@html@files@135@135-h@images@1frontispieceTH.jpg
It is 373x589 pixels (200 pixels per inch) and it looks fine.

It is as though there is something in the Scrivener created EPUB that is causing the app to scale-down when opened. Is it something in the CSS?

Thanks

mi
mickputley
Posts: 33
Joined: Sat Dec 23, 2017 1:13 am
Platform: Mac

Sun Dec 31, 2017 10:53 pm Post

Also... If I break open a downloaded EPUB which opens and looks fine. The the JPEG out of it and re-compile using Scrivener then open that EPUB, the picture looks tiny

If I create the EPub on Scrivener, break it open I see this line in the xhtml code:

<div><img src="images/1080x1440x300JPEG8-Part00-FrontCoverInside.jpg" alt="" id="1080x1440x300jpeg8-part00-frontcoverinside" style="height:346px;width:259px;" /></div>

This is a 1080x 1440 jpeg, why does the code say "height:346px;width:259px;" ???? surely this should use 'pt' not 'px' or just use "height:1440px;width:1080px;" />

Surely this is a bug


Thanks

User avatar
nontroppo
Posts: 1067
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Mon Jan 01, 2018 3:05 am Post

Hi Mick can you make a minimal test project zipped up and shared so we can have a look? It sounds as if you may be onto something. Did you check that photoshop is correctly tagging the DPI of the images you are testing with?

User avatar
gr
Posts: 1727
Joined: Wed Feb 14, 2007 3:57 am
Platform: Mac + iOS
Location: Florida

Mon Jan 01, 2018 2:46 pm Post

Now, that does sound like a problem.

I am curious what happens if you do pull up the slider like you were and then generate the epub. Does it come out correct in that case-- that is, properly sized and not unduly pixellated? (Something would still seem amiss in Scriv, but it would be informative to know and you would also know that you could work around the bug in the meantime.)

-gr

P.s. Since the epub format is driven by css, it seems to me that any internal dpi marker there might be in the image file would be irrelevant.
gr : Scrivener user : not affiliated with Lit^Lat
Image
"Nothing, like something, happens anywhere." —Philip Larkin

mi
mickputley
Posts: 33
Joined: Sat Dec 23, 2017 1:13 am
Platform: Mac

Mon Jan 01, 2018 7:20 pm Post

I will make a minimal project and send. In answer to your last question, yes and that is at the heart of it. You all had to educate me before I finally presented my final suggestion of a bug. If I slide the slider so that the points = pixels (because I was too stupid to realize that it said points) then the issue is fixed in the sense that Scrivener incorrectly codes the points to pixels and those numbers are correct. In a sense the bug took it one way and my stupidity took it back the other way. This also explains the the amazing (not) coincidence that me misreading the word 'points' for 'pixels' just happened to make the image the intended size. I agree with your last point on CSS except I can prove that not to be the case. If I break open the Scrivener produced ePUB, edit the code with a tool like Sygil (or even just a text editor) by simply changing the XHTML then the images are correct. I achieve that by not touching any CSS. What is not clear to me is whether the image looses quality if I use the slider to pretend points=pixels. My illustrations are like pencil sketches, so they may not have enough texture to tell. I'll make a project and send within the next few hours.

Thanks again for your patience.

mi
mickputley
Posts: 33
Joined: Sat Dec 23, 2017 1:13 am
Platform: Mac

Mon Jan 01, 2018 8:14 pm Post

In my zip you will find an image ColorBurst.jpg. Photoshop and Preview both agree this is 1080x1440 and 300 DPI. Used Photoshop to create this from the MacBook Pro wall paper. You will also find my minimal project and the resultant ePUB that Scrivener made.

Here is how I made it.
New Project from "Novel with Parts"
Added the graphic to the Front Matter as a cover
I also added the graphics to the second scene of part 1, chapter 1. I centered it and reduced the left indent so that the image is truly centered.
I did not touch the slider and it correctly reports 1080x1440 pixels at 300 dpi. It also correctly reports 259 x 345 points. This is expected since multiplying those numbers by 1/72 inches gives a size of 3.6 inches by 4.8 inches which is the size of a Kindle PaperWhite which is what I want and why I start with 1080x1440 at 300 DPI.
Compile to ePUB3

However, the ePUB contains the file 'body2.xhtml' which contains the following incorrect line:

<div style="text-align: center; text-indent: 0em"><img src="../Images/ColorBurst.jpg" alt="" id="colorburst" style="height:346px;width:259px;"/></div>
Attachments
Example fo LL.zip
(858.81 KiB) Downloaded 99 times

User avatar
Bridey
Posts: 390
Joined: Wed Nov 22, 2017 2:24 pm
Platform: Mac

Mon Jan 01, 2018 9:12 pm Post

But this version, using a placeholder, does work as you need it to, as a workaround?

TAG:
<$img:~/Desktop/LL/ColorBurst2.jpg;w=1080;h=1440>

OUTPUT:
<div><span style="color: #210D05; background-color: #F7F7F7"><img src="images/ColorBurst2.jpg" alt="" id="colorburst2" style="width:100%;" /></span></div>

LL.zip
(596.31 KiB) Downloaded 120 times

mi
mickputley
Posts: 33
Joined: Sat Dec 23, 2017 1:13 am
Platform: Mac

Mon Jan 01, 2018 9:43 pm Post

I must be doing something wrong, when I compile this is makes a folder with an ePUB inside but the file only shows the image from my original example but no second rendering of the image from your tag.

M