Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

added a simple python script for converting JPG image into PNG #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LAbhilashKumar wants to merge 1 commit into DhanushNehru:main
base: main
Choose a base branch
Loading
from LAbhilashKumar:fixing_issue_JPG_to_PNG

Conversation

Copy link

@LAbhilashKumar LAbhilashKumar commented May 29, 2025

This PR is on the JPG to PNG conversion task as assigned. This script leverages the Python Imaging Library (PIL) to open a .jpeg image and save it as a .png format.

Addresses issue: #204

leftkats reacted with thumbs up emoji
Copy link
Contributor

@leftkats leftkats left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution and for submitting the JPG to PNG conversion script!

A couple of notes based on our repo’s contribution guidelines and best practices:

  1. Refer to CONTRIBUTING.md and README.md
    Please ensure your pull request description follows the structure outlined in our CONTRIBUTIONS.md file. Also, don’t forget to properly update the main README.md by adding your script to the List of Scripts section with a brief description and a link to your folder. This helps maintain consistency and clarity for all contributors.

  2. Add a README.md for your script folder
    Each script folder should include a README.md that explains what the script does, any dependencies it has, and how to run it. This makes it easier for users to understand and use your script.

  3. Avoid Hardcoded File Paths
    Currently, your script uses a hardcoded absolute path to open the image (r"C:\Users\ABHILASH\OneDrive\Desktop\iron man_jpg.jpeg"), which won’t work on other machines or operating systems.
    To make the script more portable and user-friendly, consider:

  • Accepting the input file path as a command-line argument or
  • Placing the image file in the same folder as the script and referring to it with a relative path.
  1. Suggested code improvement
    For example, you could modify the script to accept an image path from the user like this:
import sys
from PIL import Image
if len(sys.argv) != 2:
 print("Usage: python convert.py <image_path>")
 sys.exit(1)
input_path = sys.argv[1]
try:
 image = Image.open(input_path)
 output_path = input_path.rsplit('.', 1)[0] + '.png'
 image.save(output_path)
 print(f"Image saved as {output_path}")
except Exception as e:
 print(f"Error occurred: {e}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@leftkats leftkats leftkats requested changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /