Index: oup/current/Tools/TxmpReplace.pas
===================================================================
--- oup/current/Tools/TxmpReplace.pas	(revision 199)
+++ oup/current/Tools/TxmpReplace.pas	(revision 201)
@@ -103,4 +103,7 @@
   new_storetype: Byte;
   formatinfo: TImageFormatInfo;
+  i: Integer;
+const
+  powers: array[0..8] of Integer = (1, 2, 4, 8, 16, 32, 64, 128, 256);
 begin
   if filelist.ItemIndex >= 0 then
@@ -111,4 +114,26 @@
     else
       ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);
+
+    if (OniImage_New.Width[1] > 256) or (OniImage_New.Height[1] > 256) then
+    begin
+      ShowMessage('Widht and height have to be smaller than or equal to 256.');
+      Exit;
+    end;
+    for i := 0 to High(powers) do
+      if OniImage_New.Width[1] = powers[i] then
+        Break;
+    if i = Length(powers) then
+    begin
+      ShowMessage('Width has to be a power of 2 (1, 2, 4, 8, 16 ...)');
+      Exit;
+    end;
+    for i := 0 to High(powers) do
+      if OniImage_New.Height[1] = powers[i] then
+        Break;
+    if i = Length(powers) then
+    begin
+      ShowMessage('Height has to be a power of 2 (1, 2, 4, 8, 16 ...)');
+      Exit;
+    end;
 
     if (OniImage_Old.Width[1] <> OniImage_New.Width[1]) or
