jpeg-convert
v1.0.26
Published
image convert in jpeg extension
Downloads
9
Readme
��#� �E�x�a�m�p�l�e�
�
�-�-�-�
�
���N�O�T�E���
�
��
��
�
�i�m�p�o�r�t� �'�.�/�A�p�p�.�c�s�s�'�;�
�
�i�m�p�o�r�t� �{� �u�s�e�S�t�a�t�e� �}� �f�r�o�m� �'�r�e�a�c�t�'�;�
�
�i�m�p�o�r�t� �j�p�e�g�C�o�n�v�e�t�e�r� �f�r�o�m� �'�j�p�e�g�-�c�o�n�v�e�r�t�'�;�
�
�
�
�f�u�n�c�t�i�o�n� �A�p�p�(�)� �{�
�
� � �c�o�n�s�t� �[�i�m�a�g�e�,�s�e�t�I�m�a�g�e�]� �=� �u�s�e�S�t�a�t�e�(�)�;�
�
� � �c�o�n�s�t� �r�e�a�d�F�i�l�e�A�s�y�n�c� �=� �(�f�i�l�e�)� �=�>� �n�e�w� �P�r�o�m�i�s�e�(�(�r�e�s�o�l�v�e�,� �r�e�j�e�c�t�)� �=�>� �{�
�
� � � � �c�o�n�s�t� �r�e�a�d�e�r� �=� �n�e�w� �F�i�l�e�R�e�a�d�e�r�(�)�;�
�
� � � � �r�e�a�d�e�r�.�o�n�l�o�a�d� �=� �(�)� �=�>� �{�
�
� � � � � � �r�e�s�o�l�v�e�(�r�e�a�d�e�r�.�r�e�s�u�l�t�)�;�
�
� � � � �}�;�
�
� � � � �r�e�a�d�e�r�.�o�n�e�r�r�o�r� �=� �r�e�j�e�c�t�;�
�
� � � � �r�e�a�d�e�r�.�r�e�a�d�A�s�D�a�t�a�U�R�L�(�f�i�l�e�)�;�
�
� � �}�)�;�
�
� � �c�o�n�s�t� �h�a�n�d�l�e�C�h�a�n�g�e� �=� �a�s�y�n�c� �(�n�a�m�e�,�v�a�l�u�e�)� �=�>� �{�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�v�a�l�u�e�)�;�
�
� � � � �c�o�n�s�t� �f�i�l�e�A�r�r�a�y� �=� �j�p�e�g�C�o�n�v�e�t�e�r�(�v�a�l�u�e�)�;�
�
� � � � �c�o�n�s�t� �r�e�s�u�l�t� �=� � �a�w�a�i�t� �r�e�a�d�F�i�l�e�A�s�y�n�c�(�f�i�l�e�A�r�r�a�y�)�;�
�
� � � � �c�o�n�s�t� �[�,� �f�i�l�e�C�o�n�t�e�n�t�]� �=� �r�e�s�u�l�t�.�s�p�l�i�t�(�'�,�'�)�;�
�
� � � � �s�e�t�I�m�a�g�e�(�f�i�l�e�C�o�n�t�e�n�t�)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�'�d�a�t�a�'�,� �f�i�l�e�A�r�r�a�y�)�;�
�
� � �}� �
�
� � �r�e�t�u�r�n� �(�
�
� � � � �<�d�i�v� �c�l�a�s�s�N�a�m�e�=�"�A�p�p�"�>�
�
� � � � � �<�i�n�p�u�t� �t�y�p�e�=�"�f�i�l�e�"� �o�n�C�h�a�n�g�e�=�{�(�e�)�=�>�{�h�a�n�d�l�e�C�h�a�n�g�e�(�'�h�e�l�l�o�'�,�e�.�t�a�r�g�e�t�.�f�i�l�e�s�[�0�]�)�}�}�/�>�
�
� � � � � �<�i�m�g� �s�r�c�=�{�
�d�a�t�a�:�i�m�a�g�e�/�j�p�e�g�;�b�a�s�e�6�4�,�$�{�i�m�a�g�e�}��}� �a�l�t�=�"�h�e�l�l�o�"� �s�i�z�e�s�=�"�m�a�x�-�w�i�d�t�h�:� �7�1�0�p�x�)� �1�2�0�p�x�,�
�
� � � � � � � � � � � � �(�m�a�x�-�w�i�d�t�h�:� �9�9�1�p�x�)� �1�9�3�p�x�,�
�
� � � � � � � � � � � � �2�7�8�p�x�"�/�>�
�
� � � � �<�/�d�i�v�>�
�
� � �)�;�
�
�}�
�
�
�
�e�x�p�o�r�t� �d�e�f�a�u�l�t� �A�p�p�;�
�
�
��
�
�
�-�-�-�