%%
date:: [[2023-04-28]]
parent::
%%
# [[Zoom in on images in Obsidian]]
To be able to zoom in on images in [[Obsidian]]:
Go to `vault/.obsidian/snippets`. If you don't see the `.obsidian` folder, you may have to enable viewing hidden files. On macOS, this is done by hitting CMD+SHIFT+`.` .
Create a new text file there called `image-zoom.css`. You can really name it anything you want.
Paste the following snippet made by [[Stephan Ango|@kepano]] into that file and save it:
```css
/* Image zoom */
/* MIT License | Copyright (c) Stephan Ango (@kepano) */
body:not(.zoom-off) .view-content div:not(.canvas-node-content) img {
max-width: 100%;
cursor: zoom-in;
}
body:not(.zoom-off) .view-content img:active {
cursor: zoom-out;
}
body:not(.zoom-off) .view-content .markdown-preview-view img[referrerpolicy=no-referrer]:active {
background-color: var(--background-primary);
padding: 10px;
}
body:not(.zoom-off) .view-content .markdown-preview-view img[referrerpolicy=no-referrer]:active,
body:not(.zoom-off) .view-content .image-embed:not(.canvas-node-content):active {
aspect-ratio: unset;
cursor: zoom-out;
display: block;
z-index: 200;
position: fixed;
max-height: calc(100% + 1px);
max-width: 100%;
height: calc(100% + 1px);
width: 100%;
-o-object-fit: contain;
object-fit: contain;
margin: -0.5px auto 0 !important;
text-align: center;
padding: 0;
left: 0;
right: 0;
bottom: 0;
}
body:not(.zoom-off) .view-content .image-embed:not(.canvas-node-content):active:after {
background-color: var(--background-primary);
opacity: 0.9;
content: " ";
height: calc(100% + 1px);
width: 100%;
position: fixed;
left: 0;
right: 1px;
z-index: 0;
}
body:not(.zoom-off) .view-content .image-embed:not(.canvas-node-content):active img {
aspect-ratio: unset;
top: 50%;
z-index: 99;
transform: translateY(-50%);
padding: 0;
margin: 0 auto;
width: calc(100% - 20px);
max-height: 95vh;
-o-object-fit: contain;
object-fit: contain;
left: 0;
right: 0;
bottom: 0;
position: absolute;
opacity: 1;
}/*# sourceMappingURL=image-zoom.css.map */
```
In Obsidian, go to Settings > Appearance. Scroll down to the last section, labeled "CSS Snippets". Click the Refresh icon. `image-zoom` should appear.
![[image-zoom.png]]
Click on the toggle to enable `image-zoom`.
Now, whenever you are looking at a photo on Obsidian, click on it and hold to zoom in.
![[image-zoom.gif]]
Not found
This page does not exist