title: Washed out and faded images when generating a PDF within a .net core project
body: <p>I have a .net core project where I am saving an HTML template string into a PDF via <a href="https://github.com/rdvojmoc/DinkToPdf" rel="nofollow noreferrer">DinkToPdf</a>.  Whilst I am successfully generating a PDF file, I am seeing some odd behaviour around images where they are appearing washed out/faded.</p>
  
  <p>Please note I do not have this issue with the generated HTML itself.</p>
  
  <p>The two links below show how the images should (and do within the HTML template) appear and how they appear within the PDF.</p>
  
  <ul>
  <li><a href="https://i.stack.imgur.com/IRuLt.jpg" rel="nofollow noreferrer">How the images appear within the HTML template.</a></li>
  <li><a href="https://i.stack.imgur.com/v9CPB.jpg" rel="nofollow noreferrer">Images appear faded from the generated PDF file.</a></li>
  </ul>
  
  <p>Interestingly, the first image in the generated PDF does not suffer from this issue (not shown).  I have compared this image with the other "washed out" images and the key difference was around their DPI (72dpi vs. 96dpi), as a test I updated one of the faded images to the same DPI but the problem persists.</p>
  
  <p>Below is my PDF generation code:</p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Generates the specified HTML content into a PDF byte array.
      /// &lt;/summary&gt;
      /// &lt;param name="htmlContent"&gt;Content of the HTML.&lt;/param&gt;
      /// &lt;param name="documentTitle"&gt;The document title.&lt;/param&gt;
      /// &lt;returns&gt;Byte array of the generated PDF contents.&lt;/returns&gt;
      public static byte[] Generate(string htmlContent, string documentTitle)
      {
          var converter = new BasicConverter(new PdfTools());
  
          var document = new HtmlToPdfDocument
          {
              GlobalSettings
                  =
                      {
                          ColorMode = ColorMode.Color,
                          Orientation = Orientation.Portrait,
                          PaperSize = PaperKind.A3,
                          DocumentTitle = documentTitle
                      },
              Objects =
                  {
                      new ObjectSettings
                          {
                              PagesCount = true,
                              HtmlContent = htmlContent,
                              WebSettings =
                                  {
                                      DefaultEncoding = "utf-8"
                                  }
                          }
                  }
          };
  
          // Return the PDF content in a byte array.
          return converter.Convert(document);
      }
  </code></pre>
  
  <p>And the HTML code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
    &lt;!-- Tagging --&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
    &lt;!-- Titles --&gt;
    &lt;title&gt;Page Title&lt;/title&gt;
    &lt;!-- Styles --&gt;
    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"&gt;
    &lt;style&gt;
      body {
        margin-left: 10px;
        margin-top: 30px;
      }
      
      #content {
        width: 100%;
        margin: 0 auto 0 auto;
      }
      
      h1 {
        float: right;
        text-transform: uppercase;
        white-space: nowrap;
      }
      
      h2 {
        color: #1E86B1;
        font-size: x-large;
      }
      
      h2.ellipsis {
        overflow: hidden;
        text-overflow: ellipsis;
        width: 500px;
      }
      
      a {
        color: #1E86B1;
        font-weight: bold;
      }
      
      a:hover {
        color: #1E86B1;
      }
      
      .thead-inverse th {
        background-color: #1E86B1;
      }
      
      td {
        text-align: right;
      }
      
      .container {
        clear: both;
      }
      
      .logo {
        width: 100px;
      }
      
      .screenshot {
        border: solid 1px #ccc;
        float: right;
      }
      
      .intro {
        margin-bottom: 0;
        margin-top: 30px;
      }
      
      .intro a {
        color: #fff;
        font-weight: bold;
      }
      
      .intro h2 {
        font-size: x-large;
        margin: 0;
        padding: 0 0 15px 0;
      }
      
      .composition-cards p:last-of-type {
        margin-bottom: 30px;
      }
      
      .cards {
        text-align: center;
        width: 100%;
      }
      
      .card {
        display: inline-block;
        float: left;
        margin: 0 0 6px 6px;
        text-align: left;
        width: 49%;
      }
      
      .card-body h2 {
        border-bottom: solid 1px #000;
        color: #000;
        font-size: 4rem;
        font-weight: 700;
        margin: 0;
        margin-bottom: 6px;
        padding-bottom: 6px;
      }
      
      .card:nth-child(3n) {
        margin-right: 0;
      }
      
      .card-img-top {
        border-bottom: 1px solid rgba(0, 0, 0, .125);
      }
      
      .clip {
        background-clip: content-box;
        display: table;
        margin-left: 0;
        overflow: hidden;
        padding-right: 0;
        padding-top: 95px;
        position: relative;
      }
      
      .clip&gt;div&gt;p {
        color: #fff;
        font-size: large;
        margin: 0;
        width: 95%;
      }
      
      .clip&gt;div {
        display: table-cell;
        vertical-align: middle;
      }
      
      .clip&gt;div:first-child {
        background-color: #42BCE2;
        border: solid 1px #42E0E2;
        border-right: none;
        border-bottom-left-radius: 15px;
        border-top-left-radius: 15px;
        padding: 30px 0 30px 30px;
      }
      
      .clip-screenshot {
        border: solid 1px #eee;
        padding: 0;
      }
      
      .compositions h3 {
        color: #fff;
        font-size: large;
        text-transform: uppercase;
      }
      
      .compositions .row .col {
        background-color: #42BCE2;
        border: solid 1px #42E0E2;
        border-radius: 15px;
        margin: 5px;
        padding: 20px;
      }
      
      .divider,
      .no-divider {
        border-bottom: solid 1px #eee;
        padding: 30px 0 30px 0;
      }
      
      .divider:last-of-type,
      .no-divider {
        border-bottom: none;
        margin-bottom: 10px;
      }
      
      .divider:last-of-type&gt;div&gt;div {
        color: #666;
        text-align: center;
      }
      
      .divider:last-of-type&gt;div&gt;div a {
        font-weight: normal;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div id="content"&gt;
      &lt;div class="container no-divider"&gt;
        &lt;div class="row"&gt;
          &lt;div class="col composition-cards"&gt;
            &lt;div class="cards"&gt;
              &lt;div class="card"&gt;
                &lt;img class="card-img-top" src="{serverProcessingImage}"&gt;
                &lt;div class="card-body"&gt;
                  &lt;h4 class="card-title"&gt;Card Title&lt;/h4&gt;
                  &lt;p class="card-text"&gt;
                    Content here...
                  &lt;/p&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="card"&gt;
                &lt;img class="card-img-top" src="{htmlFilesImage}"&gt;
                &lt;div class="card-body"&gt;
                  &lt;h4 class="card-title"&gt;Card Title&lt;/h4&gt;
                  &lt;p class="card-text"&gt;
                    Content here...
                  &lt;/p&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="card"&gt;
                &lt;img class="card-img-top" src="{imagesImage}"&gt;
                &lt;div class="card-body"&gt;
                  &lt;h4 class="card-title"&gt;Card Title&lt;/h4&gt;
                  &lt;p class="card-text"&gt;
                    Content here...
                  &lt;/p&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="card"&gt;
                &lt;img class="card-img-top" src="{javaScriptImage}"&gt;
                &lt;div class="card-body"&gt;
                  &lt;h4 class="card-title"&gt;Card Title&lt;/h4&gt;
                  &lt;p class="card-text"&gt;
                    Content here...
                  &lt;/p&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="card"&gt;
                &lt;img class="card-img-top" src="{otherResourcesImage}"&gt;
                &lt;div class="card-body"&gt;
                  &lt;h4 class="card-title"&gt;Card Title&lt;/h4&gt;
                  &lt;p class="card-text"&gt;
                    Content here...
                  &lt;/p&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="card"&gt;
                &lt;img class="card-img-top" src="{styleSheetsImage}"&gt;
                &lt;div class="card-body"&gt;
                  &lt;h4 class="card-title"&gt;Card Title&lt;/h4&gt;
                  &lt;p class="card-text"&gt;
                    Content here...
                  &lt;/p&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The images themselves are pulled in and converted into byte arrays - these are then Base64 encoded into the HTML template.  The same code to pull down and encode the images is used so I do not currently see this as the root cause.</p>
  
  <p>Please do share any thoughts/suggestions with me.  Thanks, Ben.</p>