Solved

Convert TIFF to JPEG Extension Issue

Posted on 2010-11-16
5
639 Views
Last Modified: 2012-05-10
I'm trying to use a SSIS 2008 package to go to a file share folder, retrieve all the files which will be in the Tiff format, and save them to another location (on the same server) so web users can have web access to them.  The catch is these pictures need to be saved as a gif or jpeg (what are some thoughts on .png?).

 I have the below code that is in a SSIS script task.  The SSIS package works, with no errors; however, it saves the tiff files as a Tiff file.  If i use an .aspx environment (I find this easier to test), the files are transfered to the correct folder, however, they don't have an extension (no .jpeg, .tiff, etc.)

 I developed this code on my computer and it works flawlessly, however, once I put it on the production server, this issue started to show up.  The production server doesn't recognize the jpeg or gif format, could this have something to do with it?

 Imports System
Imports System.Data
Imports System.Math
Imports System.Drawing
Imports System.IO
Imports System.Drawing.Imaging.ImageFormat
Imports Microsoft.SqlServer.Dts.Runtime


Public Sub Main()
        Dim StoreFile As Directory
        Dim Directory As String
        Dim Files As String()
        Dim File As String
        Dim bm As Bitmap

        'Asign Save as Location
        Directory = "C:\xx\xx\website\Folder\ChartImages\"

        'Asign the files to variable
        Files = StoreFile.GetFiles("X:\x")

        'Loops through the files
        For Each File In Files
            bm = Bitmap.FromFile(File)
            bm.Save(Directory & System.IO.Path.GetFileName(File) & "", Jpeg)
        Next
End Sub
0
Comment
Question by:badrhino
  • 3
  • 2
5 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 34147581
GIF and PNG formats are better for line art or graphic design where the image has large areas of solid colors.

Jpeg is best for photographs and pictures with fine detail.

PNG may be the best option for you if the encoders are installed.
0
 
LVL 1

Author Comment

by:badrhino
ID: 34147616
Thanks for the response and the advice on the file format!

How do I know if the encoder is installed, and if it isn't, how do I do this?

Thanks!
0
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 500 total points
ID: 34147849
When you save the file, it does not look like you are changing the file extension from .tiff to .jpeg.

shouldn't this
bm.Save(Directory & System.IO.Path.GetFileName(File) & "", Jpeg)

be this?
bm.Save(Directory & System.IO.Path.GetFileName(File) & ".JPG", Jpeg)
0
 
LVL 1

Author Comment

by:badrhino
ID: 34147954
Not sure how I missed that, but your correct.  I changed it in my code and it works great.  
Thanks!
0
 
LVL 1

Author Comment

by:badrhino
ID: 34147963
Perhpas I should learn how to type....

Not sure how I missed that, but you're correct.  I changed it in my code and it works great.  
Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question