# Override max graphics dimensions in latex?

So, I'm writing a report on powerautomate flow code. I'm attaching screenshots in the appendix of code (because it's visual code blocks), but these are VERY large images. (3500x21094) with a really tight ratio.

I'm using code inspired by this post to split the images into pages :

\documentclass[11pt,a4paper]{article}
\usepackage{fp}
\usepackage{graphicx}
\graphicspath{ {./Assets/} }
\newcommand{\cropImg}[3]{
\FPeval{\top}{#2 / #3}
\FPeval{\bot}{(#3-#2-1) / #3}

width=\textwidth,
trim={0 {\bot\height} 0 {\top\height}},
clip, % needed for trim to work
]{#1}
}

\begin{document}
\cropImg{LargePowerFlowImage}{1}{10}

\end{document}


I'm running into "dimensions too large" when running this on some of my tallest screenshots when building though.

This link suggests this is because I'm going beyond the capacity of latex, and the images wouldn't fit.HOWEVER it's only too big as an actual image, and the result of \cropimage is well within reason.

ABD: EveryShipout initializing macros ( FP-EVAL ( FP-UPN ( FP-DIV ) ) )
( FP-EVAL ( FP-UPN ( FP-SUB ) ( FP-SUB ) ( FP-DIV ) ) )
! Dimension too large.
<argument> \ht \@tempboxa

l.19   \cropImg{FlowCompute}{1}{10}


Is there a way to override Latex's limits on graphics size so I can import those screenshots into the code, where they are broken down ? (also posted on Reddit

• as the links says there is a maximum size TeX can handle. It doesn't matter that you crop, it has to get the natural size first. Reduce the size in some external graphic program. Aug 6 at 9:27
• you are not hitting any limit related to graphics some intermdiate length has size bigger than \maxdimen so you overflow tex arithmetic this is a hard limit but you can probably re-arrange the calculations to require different arithmetic, or better generate the images using external tools so they are correct size without scaling or trimming. Aug 6 at 9:36
• @DavidCarlisle is it possible to renewcommand or something similar to change that limit within a document ? Breaking down those screenshots in subcomponents would be a bit of a pain. Aug 6 at 12:29
• No it is built in to the syntax of TeX, you can not change this even if you compile the TeX program from source. It is almost certainly better anyway to do this externally. You are scaling and cropping a bitmap but that is just a pdf masking, the full large bitmap data is included if you trim. It may or may re-use the bitmap data or may include it all again for each tile depending on ... things Aug 6 at 12:38
• Oh okay. thanks :) Aug 7 at 8:26