<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Изменить дату съемки картинок]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13047&amp;type=atom" />
	<updated>2017-10-04T15:04:00Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13047</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119805#p119805" />
			<content type="html"><![CDATA[<p>Тут перенос не нужен, тут же файл два раза сохраняется, первый раз в Temp, второй из Temp на место исходного.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-04T15:04:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119805#p119805</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119800#p119800" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong>, пытаемся сохранить jpg без потери качества.<br /><strong>teadrinker</strong>, твой код работает правильно, сохраняет без потерь, но если длина и ширина картинки кратна 16.<br /></p><div class="quotebox"><blockquote><p>If the following conditions are met, then the transformation will proceed without loss of information:<br />&nbsp; &nbsp; The file used to construct the Image object is a JPEG file.<br />&nbsp; &nbsp; The width and height of the image are both multiples of 16.<br />If the width and height of the image are not both multiples of 16, GDI+ will do its best to preserve the image quality when you apply one of the rotation or flipping transformations shown in the preceding list.</p></blockquote></div><p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms533845(v=vs.85).aspx">https://msdn.microsoft.com/en-us/librar … s.85).aspx</a><br />Но у тебя в коде пропала строка о переносе файла - осталась только стирание с TEMP.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-04T07:54:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119800#p119800</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119796#p119796" />
			<content type="html"><![CDATA[<p>Не очень понимаю что тут за шаманство, могу сказать что знаю про JPG из практики.<br />В отличие от PNG этот алгоритм сжатия по определению даёт искажение цветов, даже при настройках 100% качества. Зато при незначительном уменьшении качества значительно уменьшается размер файла. Например снимок экрана 1280x1024:<br />100%&nbsp; &nbsp;275 кб;<br />95% 174 кб;<br />90% 137 кб.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-10-04T03:55:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119796#p119796</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119795#p119795" />
			<content type="html"><![CDATA[<p>Не, ничего не вышло. То-есть, код вышел, но файл всё равно теряет качество. Вот функция, которая проворачивает файл два раза, на 90 и 270 градусов:<br /></p><div class="codebox"><pre><code>RotateImage(A_Desktop . &quot;\test.jpg&quot;)

RotateImage(imagePath)  {
   static EncoderParameterValueTypeLong := 4
       , #EncoderValueTransformRotate90 := 13
       , #EncoderValueTransformRotate270 = 15
        
   hModule := DllCall(&quot;LoadLibrary&quot;, &quot;str&quot;, &quot;gdiplus.dll&quot;, Ptr)
   VarSetCapacity(si, 8 + A_PtrSize*2, 0)
   si := Chr(1)
   DllCall(&quot;gdiplus\GdiplusStartup&quot;, PtrP, pToken, Ptr, &amp;si, Ptr, 0)
   SplitPath, imagePath,, imageDir, ext, nameNoExt
   if !RegExMatch(ext, &quot;i)^J(PG|PEG|PE|FIF)$&quot;)  {
      MsgBox, Файлы %ext% не поддерживаются
      Return
   }
   Loop 2  {
      nSize := nListSize := nCount := pCodec := &quot;&quot;
      DllCall(&quot;gdiplus\GdipLoadImageFromFile&quot;, WStr, imagePath, PtrP, pBitmap)
      
      DllCall(&quot;gdiplus\GdipGetImageEncodersSize&quot;, UIntP, nCount, UIntP, nSize)
      VarSetCapacity(ci, nSize)
      DllCall(&quot;gdiplus\GdipGetImageEncoders&quot;, UInt, nCount, UInt, nSize, Ptr, &amp;ci)
      if !(nCount &amp;&amp; nSize)
         return -2
      
      Loop, % nCount  {
         sString := StrGet(NumGet(ci, (idx := (48+7*A_PtrSize)*(A_Index-1))+32+3*A_PtrSize), &quot;UTF-16&quot;)
         if InStr(sString, &quot;*.&quot; ext)  {
            pCodec := &amp;ci+idx
            break
         }
      }

      DllCall(&quot;gdiplus\GdipGetEncoderParameterListSize&quot;, Ptr, pBitmap, Ptr, pCodec, UintP, nListSize)
      VarSetCapacity(EncoderParameters, nListSize, 0)
      DllCall(&quot;gdiplus\GdipGetEncoderParameterList&quot;, Ptr, pBitmap, Ptr, pCodec, UInt, nListSize, Ptr, &amp;EncoderParameters)
      NumPut(1, EncoderParameters, 0, &quot;UInt&quot;)
      NumPut(1, EncoderParameters, 16 + A_PtrSize, &quot;UInt&quot;)
      NumPut(EncoderParameterValueTypeLong, EncoderParameters, 20 + A_PtrSize, &quot;UInt&quot;)
      NumPut(A_Index = 1 ? #EncoderValueTransformRotate90 : #EncoderValueTransformRotate270, NumGet(EncoderParameters, 24 + A_PtrSize) + 0, &quot;UInt&quot;)
      
      sOutput := ( A_Index = 1 ? A_Temp : imageDir ) . &quot;\&quot; . nameNoExt . &quot;.jpg&quot;
      if A_IsUnicode
         pOutput := &amp;sOutput
      else  {
         VarSetCapacity(wOutput, StrPut(sOutput, &quot;UTF-16&quot;)*2, 0)
         StrPut(sOutput, &amp;wOutput, &quot;UTF-16&quot;)
         pOutput := &amp;wOutput
      }
      DllCall(&quot;gdiplus\GdipSaveImageToFile&quot;, Ptr, pBitmap, Ptr, pOutput, Ptr, pCodec, Ptr, &amp;EncoderParameters)
      DllCall(&quot;gdiplus\GdipDisposeImage&quot;, Ptr, pBitmap)
      imagePath := A_Temp . &quot;\&quot; . nameNoExt . &quot;.jpg&quot;
   }
   DllCall(&quot;gdiplus\GdiplusShutdown&quot; , Ptr, pToken)
   DllCall(&quot;FreeLibrary&quot;, Ptr, hModule)
   
   FileDelete, % A_Temp . &quot;\&quot; . nameNoExt . &quot;.jpg&quot;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-04T01:43:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119795#p119795</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119793#p119793" />
			<content type="html"><![CDATA[<p>Удалось развернуть картинку, но пока только для 32 бит, в 64 надо со смещениями разобраться.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-03T23:20:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119793#p119793</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119792#p119792" />
			<content type="html"><![CDATA[<p>И размер увеличивается в полтора раза.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-03T22:55:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119792#p119792</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119791#p119791" />
			<content type="html"><![CDATA[<p>Если качество указать 100%, не сильно меняется, цвет искажается немного.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-03T22:50:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119791#p119791</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119790#p119790" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Да, уменьшает, но чем более информативный файл, тем меньше сокращение, видимо, оптимизирует как-то</p></blockquote></div><p>Ухудшение качества хорошо видно на этой картинке - пропусти ее через скрипт раз 10.<br /><span class="postimg"><img src="http://lurkmore.so/images/e/ee/Fuckyeah.jpg" alt="http://lurkmore.so/images/e/ee/Fuckyeah.jpg" /></span></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-03T22:36:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119790#p119790</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119788#p119788" />
			<content type="html"><![CDATA[<p>А, вроде разобрался, попозже попробую переписать.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-03T22:32:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119788#p119788</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119785#p119785" />
			<content type="html"><![CDATA[<p>По первой ссылке разве не то же самое, что в Gdip.ahk?<br />По второй можно посмотреть.<br />Да, уменьшает, но чем более информативный файл, тем меньше сокращение, видимо, оптимизирует как-то. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-03T21:44:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119785#p119785</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119784#p119784" />
			<content type="html"><![CDATA[<p><a href="https://autohotkey.com/board/topic/10810-image-conversions-and-capturing-with-gdi/page-3#entry102599">https://autohotkey.com/board/topic/1081 … ntry102599</a><br /><a href="http://www.nullskull.com/articles/20030706.asp">http://www.nullskull.com/articles/20030706.asp</a><br />Кстати, виндовс при изменении даты съёмки у Screenshot_4.png уменьшает файл аж в 3 раза.<br />Интересно за счёт чего?<br />В более ранней библиотеки эти параметры были учтены:<br /><a href="https://github.com/Drugoy/Autohotkey-scripts-.ahk/blob/master/Libraries/GDIPlusHelper.ahk">https://github.com/Drugoy/Autohotkey-sc … Helper.ahk</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-03T21:32:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119784#p119784</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119782#p119782" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Можно это обойти таким способом:</p></blockquote></div><p>А ты какой конкретно код имеешь в виду? Дай ссылку на конкретный пост (можно получить, если навести мышь слева внизу поста).</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-03T21:21:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119782#p119782</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119781#p119781" />
			<content type="html"><![CDATA[<p><strong>belyankin12</strong>, дату съемки виндовс берет у разных расширений по-разному.<br />PNG не поддерживает EXIF, и виндовс берет ее значение из&nbsp; PNG:CreationTime тага.<br />Так что, наверное, лучше использовать специальные программы типа&nbsp; Exiftool, которые предусмотрели подобные ситуации, либо парсить и изменять хедеры файлов самому.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-03T21:04:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119781#p119781</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119780#p119780" />
			<content type="html"><![CDATA[<p>Все верно, прописал filecopy со сменой разрешения на jpg и все заработало. Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-10-03T21:01:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119780#p119780</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить дату съемки картинок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119779#p119779" />
			<content type="html"><![CDATA[<p>Не, размер меняется.<br />А там дело именно в lossless кодировании при повороте картинки.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-03T20:48:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119779#p119779</id>
		</entry>
</feed>
