# Convert a PDF saved root TH2 histogram to a root TH2

**URL:** <https://root-forum.cern.ch/t/convert-a-pdf-saved-root-th2-histogram-to-a-root-th2/52073>\
**Category:** Newbie\
**Created:** [October 24, 2022, 4:05pm UTC](https://root-forum.cern.ch/t/convert-a-pdf-saved-root-th2-histogram-to-a-root-th2/52073 "2022-10-24T16:05:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ROOTer1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/977dab/32.png) [@ROOTer1](https://root-forum.cern.ch/u/ROOTer1)\
**Post date:** [October 24, 2022, 4:05pm UTC](https://root-forum.cern.ch/t/convert-a-pdf-saved-root-th2-histogram-to-a-root-th2/52073/1 "2022-10-24T16:05:42Z")

</div>

It might be impossible, but I was wondering if there is anyway to convert a TH2 histogram that was saved as PDF to a root TH2 histogram based on the colours of the COLZ option

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [October 25, 2022, 7:08am UTC](https://root-forum.cern.ch/t/convert-a-pdf-saved-root-th2-histogram-to-a-root-th2/52073/2 "2022-10-25T07:08:43Z")

</div>

Try: `yourTH2->Draw("COLZ");`

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [October 25, 2022, 9:13am UTC](https://root-forum.cern.ch/t/convert-a-pdf-saved-root-th2-histogram-to-a-root-th2/52073/3 "2022-10-25T09:13:53Z")

</div>

I think they mean they don’t have access to the TH2, only to an image (PDF) of the result of doing `h->Draw("colz")`. In that case, it is not possible to automatically get a TH2 from that; they would have to do some bin by bin colour matching to the colour scale, by hand in some image editor, or with some script; but even with this, the values will most probably not be exact.

---

<div class="post-metadata">

**Author:** ![ROOTer1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/977dab/32.png) [@ROOTer1](https://root-forum.cern.ch/u/ROOTer1)\
**Post date:** [October 25, 2022, 11:38am UTC](https://root-forum.cern.ch/t/convert-a-pdf-saved-root-th2-histogram-to-a-root-th2/52073/4 "2022-10-25T11:38:07Z")

</div>

Yeah I knew that it’s an impossible task, but I was hoping for some magic anyway 🙂

Thank you very much for your reply!
