Commit 81eab9553 for imagemagick.org

commit 81eab9553d850ec305f70a51687eb85629f9d1e3
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Sun Jul 5 08:57:53 2026 -0400

    delay image extent check

diff --git a/coders/txt.c b/coders/txt.c
index dc99215f9..da252cbe7 100644
--- a/coders/txt.c
+++ b/coders/txt.c
@@ -456,11 +456,6 @@ static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception)
       ThrowReaderException(CorruptImageError,"ImproperImageHeader");
     for (depth=1; ((double) GetQuantumRange(depth)+1) < max_value; depth++) ;
     image->depth=depth;
-    status=SetImageExtent(image,image->columns,image->rows,exception);
-    if (status != MagickFalse)
-      status=ResetImagePixels(image,exception);
-    if (status == MagickFalse)
-      return(DestroyImageList(image));
     LocaleLower(colorspace);
     i=(ssize_t) strlen(colorspace)-1;
     image->alpha_trait=UndefinedPixelTrait;
@@ -472,6 +467,11 @@ static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     type=ParseCommandOption(MagickColorspaceOptions,MagickFalse,colorspace);
     if (type < 0)
       ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+    status=SetImageExtent(image,image->columns,image->rows,exception);
+    if (status != MagickFalse)
+      status=ResetImagePixels(image,exception);
+    if (status == MagickFalse)
+      return(DestroyImageList(image));
     (void) SetImageColorspace(image,(ColorspaceType) type,exception);
     (void) SetImageBackgroundColor(image,exception);
     range=GetQuantumRange(image->depth);